未定义的本地变量或方法`has_no_table'
-
21-12-2019 - |
题
这是我的“注意”型号:
class Note < ActiveRecord::Base
has_no_table
column :title, :string
column :contents, :string
def update_spreadsheet
connection = GoogleDrive.login(ENV["GMAIL_USERNAME"], ENV["GMAIL_PASSWORD"])
ss = connection.spreadsheet_by_title('central-app-notes')
if ss.nil?
ss = connection.create_spreadsheet('central-app-notes')
end
ws = ss.worksheets[0]
last_row = 1 + ws.num_rows
ws[last_row, 1] = Time.new
ws[last_row, 2] = self.title
ws[last_row, 3] = self.content
ws.save
end
end
.
我还添加了“google_drive”gem。
但是,当我尝试使用表单访问页面时,我收到此错误:undefined local variable or method `has_no_table'
.
我不确定发生了什么,并会欣赏一些帮助。谢谢!
解决方案
方法属世义是来自ActiveRecord-Tableless Gem
的方法所以包括在你的gemfile
中gem "activerecord-tableless", "~> 1.0"
.
捆绑并重新启动您的服务器,希望有助于
还看看 activeRecord-theachellesg gem 更多信息
不隶属于 StackOverflow