thefrontiergroup / scoped_attr_accessible

A plugin for ActiveModel-based libraries that lets you scope attr_accessible and attr_protected
MIT License
18 stars 1 forks source link

Globally define scope #2

Open Ruxton opened 13 years ago

Ruxton commented 13 years ago

It'd be awesome to be able to globally define a scope, rather than having to enter it in every model or have it inherited from nested attributes.

groe commented 13 years ago

I agree with you, that would be very useful. Currently I am using something like this in my controller to get around this ugh def with_wizard_scope ModelA.with_sanitizer_scope :wizard do ModelB.with_sanitizer_scope :wizard do ModelC.with_sanitizer_scope :wizard do ModelD.with_sanitizer_scope :wizard do ModelE.with_sanitizer_scope :wizard do ModelF.with_sanitizer_scope :wizard do ModelG.with_sanitizer_scope :wizard do ModelH.with_sanitizer_scope :wizard do ModelI.with_sanitizer_scope :wizard do ModelJ.with_sanitizer_scope :wizard do yield end end end end end end end end end end end

Is there any better way if I dont want to set the scope permanently?

btw: great gem :)