【发布时间】:2015-02-14 03:59:41
【问题描述】:
我正在尝试通过 gem 在我的笔记模型上使用标签。但是,即使我在尝试提交它们时已明确添加(2 种单独的方式) :tag_list => [] 到我的笔记控制器的强参数中,我仍然会在日志中收到未经许可的参数错误?我已经运行了捆绑安装和迁移。
这是我的文件:
#/models/note.rb
class Note < ActiveRecord::Base
belongs_to :user
acts_as_taggable
validates_presence_of :name, :note_text, :note_style, :note_description
end
#/controllers/notes_controller.rb
.
.
.
def note_params
params.require(:note).permit(:name, :note_style, :note_text, :note_description, :tag_list => [])
end
还有我的笔记表格:
.form-group
= f.label :tag_list, "Tags (seperate by comma)"
= f.text_field :tag_list, class: 'form-control'
我遵循了 gem 中的所有内容,但我仍然无法让它工作。
【问题讨论】:
标签: ruby-on-rails tags