[Rails] Re: passing a variable from controller to model
Anand
mail2sanand at gmail.com
Fri Jul 28 13:11:48 GMT 2006
Create a Model Object
Suppose the Model's name is form.rb
in the controller, create an object for this model
form_object = Form.new
now assign an element to this object.
form_object['element1'] = "Hi this is the .............."
now call the method in the model which is defined belw.
form_object.validate_this
in the model Form. .....
define a method like validate_this
def validate_this
puts "The variable is #{element1}"
end
now u can access this variable in this method
Regards,
Anand
--
Posted via http://www.ruby-forum.com/.
More information about the Rails
mailing list