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

Était-ce utile?

La 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
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top