The problem variable here is @item_class . It's not passing as an extra
parameter.
I have in my partial
<%= @item_class.name %> #Just to make sure @item_class is not null
<%= link_to_if someCondition, 'myLink', :action=>:myLinkAction, :id =>
@item ,:item_class=> @item_class.name %>
the above renders
Photo
<a href="/item/myLinkAction/10">myLink</a>
which is missing the extra parameter Photo.
Why don't I see
<a href="/item/myLinkAction/10?item_class=Photo">myLink</a>
if I add a string like 'wibble'
<%= link_to_if someCondition, 'myLink', :action=>:myLinkAction, :id =>
@item ,:item_class=> @item_class.name , :extra=>'wibble' %>
I get
Photo
<a href="/item/myLinkAction/10?extra=wibble">myLink</a>
Ok, if I switch it to
<%= @item_class.name %>
<%= link_to_if someCondition, 'myLink', :action=>:myLinkAction, :id =>
@item ,:extras=> @item_class.name , :item_class=>'wibble' %>
I get
Photo
<a href="/item/myLinkAction/10?extras=Photo">myLink</a>
What's the problem with using a parameter having a same name as a
variable? I didn't see this issue until I went to 1.2.2 from 1.1.6.
I REALLY appreciate the help, it's been about 2 weeks I've been
wrestling with this.
One other note, this only happens with named routes. item_class is
assigned in the named route, I get the results above. If I manually
type it into the url, it's fine.
I'll try your suggestion. Thanks again for the help.
Ok if I return the various arguments passed in, I see:
condition: true
name: myLink
options:item_classwibbleextrasPhotoactionmyLinkActionid
html_options: NULL
*parameters_for_method_reference: NULL
No block supplied, so didn't check that.
What were you expecting for *parameters for method_reference?
eden_li
(eden li)
March 12, 2007, 3:00am
5
parameters_for_method_reference should probably be nil.
What is the route for this action? What does
url_for(:action=>:myLinkAction, :id =>
The url_for generates:
/item/myLinkAction?extras=Photo