On Wednesday, October 10, 2012 2:30:57 PM UTC+1, jim wrote: > > > > On Wed, Oct 10, 2012 at 11:25 PM, paul h <pa...@hollyer.me.uk<javascript:> > > wrote: > >> Hi Norbert, >> >> Thanks for the reply, but can you elaborate a little? >> >> On Wednesday, October 10, 2012 12:01:54 PM UTC+1, Norbert Melzer wrote: >>> >>> >>> Am 10.10.2012 09:47 schrieb "paul h" <pa...@hollyer.me.uk>: >>> >>> > # I want to be able to display 'bar' on the contacts page >>> > = link_to "Contacts", contacts_path, :data => {:foo => 'bar'} >>> >>> Should be params=>.... I here if I recall correctly. >>> >> >> Doesn't appear to be, replacing :data with :params changes the HTML link >> as follows: >> data-foo='bar' becomes params="{:foo=>"bar"}" >> >> Changing :data to params just mashes up the html link. >> >> AFAIK the generated HTML link is correct data-foo='bar', shouldn't this >> be accessible in the controller as part of the params hash? >> >> If I inspect the params hash, all that is there is the usual key/value >> pairs: controller, action, (when applicable => id, method, >> authenticity_token). >> >> How can I send an additional data attribute to the controller? Do I have >> problem with my routes? >> > > pass it on the named route > > link_to 'foo', foo_path(:foo => 'bar', :blah => 'baz') >
Thanks Jim, that's what I was after. I confused something I saw previously with JS (thanks to Matt (below) for jogging my memory) - probably the Railscast for Unobtrusive JS. Thanks again. > > >> >> Thanks >> >> Paul >> >> -- >> 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 >> rubyonra...@googlegroups.com<javascript:> >> . >> To unsubscribe from this group, send email to >> rubyonrails-ta...@googlegroups.com <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/rubyonrails-talk/-/lN53bwOAiNoJ. >> >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > > > -- > ------------------------------------------------------------- > visit my blog at http://jimlabs.heroku.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 rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/J7DyOeSBRhoJ. For more options, visit https://groups.google.com/groups/opt_out.