Aldric Giacomoni wrote:
> John Merlino wrote:
>> Hey all,
>> 
>> Can't find a good explanation of options={}. Specifically I'm not sure
>> of its role in this given line of code:
>> 
>> helper file:
>> 
>>   def render_show_actions(resource, actions, options={})
>>     commands = actions.map do |action|
>>       send "render_show_action_#{action}", resource, options
>>     end
>> 
>> controller:
>> 
>>   def render_show_action_pass(student, options={})
>>     @template.link_to "pass", pass_student_path(student), :method =>
>> :get
>>   end
>>   helper_method :render_show_action_pass
>> 
>> It appears that the action in the helper dynamically builds the action
>> in controller. But then the question is what is options doing there and
>> which method is calling which?
>> 
>> Thanks for any suggestions.
> 
> 
> def wow array=[1]
>   array
> end
> 
> wow
> 
> copy and paste this in IRB and you'll understand. "options={}" says that 
> if no variable is passed for 'options', make it an empty hash.
> The rest of the code should make some more sense.

Yup.  If you're having trouble with this, please review your basic Ruby 
syntax.

Best,
-- 
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
-- 
Posted via http://www.ruby-forum.com/.

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to