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.
ThanksPaulTo view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/lN53bwOAiNoJ.--
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.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
On Wed, Oct 10, 2012 at 11:25 PM, paul h <pa...@hollyer.me.uk> 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 routelink_to 'foo', foo_path(:foo => 'bar', :blah => 'baz')
--Matt Jones
Colin