Hey people,
does anyone know if it's possible to access params inside the before_validation function?
Hey people,
does anyone know if it's possible to access params inside the before_validation function?
Hey people,
does anyone know if it's possible to access params inside the before_validation function?
before_validation callbacks are instance methods of models, params is
an instance method of controllers therefore you cannot call params
from a before_validation callback.
Fred
Aren't you doing something like Foo.new( params[:foo] ) already?
params is an array and responds to merge, so you can add stuff to params before passing it to the model.
Sounds like you need to add attr_accessor entries.
attr_accessor :current, :required
Greg Donald wrote:
...
attr_accessor :current, :required
-- Greg Donald http://destiney.com/
Yep, that's what I needed. Thanks to both of you!