Generating link path with parameters

Posted by fl00r on Stack Overflow See other posts from Stack Overflow or by fl00r
Published on 2010-06-03T11:31:01Z Indexed on 2010/06/03 11:34 UTC
Read the original article Hit count: 203

Filed under:
|

Hi. I've got model with many associations.

User :has_many => :posts, :videos, :images etc

I've got helper method, which receives one of this association

draw_chart user.videos

def draw_chart(assoc)
  assoc.each do |a|
    link_to "update", [a.user, a], :method => :put, :remote => true, :confirm => 'orrly?'
  end
end

Problem here is to send extra parameters to update action.

For example I want to get this url: /users/1/videos/2?status=done but I am confused how to realize this while I am using [a.user, a] instead of user_videos_path(video, :status => 'done'). But I can't use last, because it can be either videos, or images or anything else

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby