ES wrote:
> I have an index page of 'objects A' who each have many of another
> 'object B'.
> 
> I want to have a link that will open a popup and list all the object
> B's of an object A.
> 

class A
  has_many :bs
end

class B
  belongs_to :a
end

(AsController)
def b_popup
  @a = A.find(params[:id])
  @bs = @a.bs
end

(A index view)
link_to('test',
        {:controller => 'as',
         :action => 'b_popup',
         :id => a.id},
        {:popup => [your stuff here]})

make sure your route in the link_to is available in routes.rb via 
map.resources for your object A
-- 
Posted via http://www.ruby-forum.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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to