On Fri, Nov 13, 2009 at 10:39 AM, Kalpesh1 Patel
<rails-mailing-l...@andreas-s.net> wrote:
>
> Frederick Cheung wrote:
>> On Nov 13, 9:00�am, Kalpesh1 Patel <rails-mailing-l...@andreas-s.net>
>> wrote:
>>
>>> When I run this in browser, it throws error "Wrong number of arguments
>>> (0 for 1)". Obviously, my method "init_name" expects one parameter and
>>> it doesn't find any while called(by controller??). Basically I want to
>>> send this 'cname' variable from controller to model. Can anybody tell me
>>> what can I do in controller method so that 'cname' variable is passed
>>> when callback method is called?
>>
>> Callbacks like before_create can't take any arguments
>>
>> Fred
>
> So isn't there any way I can pass some value from controller to model?
What do you mean? Of course you can pass values, in fact, you're
passing a value there.
I don't see the need of doing something like the before_create hook.
Why don't you just pass the value to the constructor? Simple.new(:name
=> params[:simple])


-- 
Leonardo Mateo.
There's no place like ~

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to