Forum: Ruby on Rails render partial collection

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
isabelle (Guest)
on 2006-05-03 20:58
my view contains a call to a partial:

  <%= render(:partial => 'item_list', :collection => @keyword.synonyms,
  :locals => { :action_delete => "removesynonym", and_some_other_stuff
})
  %>


_item_list.rhtml contains:

  <%= link_to (
	  image_tag('/images/deletebutton.png'),
	  { :action => action_delete,
	    :id => @keyword,
	    item_id => item_list }, %><%= item_list.name %>

Now, how can I pass the 'name' property from my main view? This does not
work:

  <%= render(:partial => 'item_list', :collection => @keyword.synonyms,
  :locals => { :action_delete => "removesynonym",
               :my_property => "name" })
  %>

_item_list.rhtml:

  <%= link_to (
	  image_tag('/images/deletebutton.png'),
	  { :action => action_delete,
	    :id => @keyword,
	    item_id => item_list }, %><%= item_list.my_property %>

I tried
item_list."#{my_property}"
no luck

Any hints greatly appreciated
Brian H. (Guest)
on 2006-05-03 21:48
(Received via mailing list)
On May 3, 2006, at 12:58 PM, isabelle wrote:
> _item_list.rhtml:
>
> Any hints greatly appreciated

What you want is: item_list.send(my_property)

-Brian
Iphan I. (Guest)
on 2006-05-04 11:56
Brian H. wrote:
> On May 3, 2006, at 12:58 PM, isabelle wrote:
>> _item_list.rhtml:
>>
>> Any hints greatly appreciated
>
> What you want is: item_list.send(my_property)

that did it.

thanks so much for your help.

Isabelle
This topic is locked and can not be replied to.