Rails link_to assigning class and id
问题 <%= link_to event do %> #bunch of stuff making up the partial. <% end %> So I'm trying to assign an ID and a class to each item in a partial. I've seen where you have to call the full link_to function like <%= link_to event, { controller: :controller, action: :action }, {class: 'someClass', id: 'someId' } %> . That's not working for me, because of the do block, methinks? Ideas? 回答1: Does this work for you? <%= link_to event, id: "an-id", class: "some-class" do %> #bunch of stuff making up the