On Wed, Oct 10, 2012 at 11:25 PM, paul h <[email protected]> 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" <[email protected]>: >> >> > # 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 > > 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]. > 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

