Question

how override attr_accessible role for field :name in Tag model in ActsAsTaggableOn gem ?

I want some things like that in Tag model ...

attr_accessible :name, :as => [:default, :admin]

for allow me to edit field name of tag by admin role

Was it helpful?

Solution

You can monkey patch acts_as_taggable_on by creating a file in config/initializers and adding the following lines. Restart your rails server for changes to take effect.

ActsAsTaggableOn::Tag.class_eval do
  attr_accessible :name, :as => [:default, :admin]
end
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top