Hello, I have two tables with association HABM, projects and users, and
in projects I want to show all users that was associated to the project.

I have try with this:

<%= select( "user", "id", Project.all.collect { |p| [ p.name, p.id ] } )
%>

But only show all my projects, but Iz don't know who show only the user
in a determinated project.


class Project < ActiveRecord::Base

  has_attached_file :image, :styles => { :medium => "300x200>", :thumb
=> "100x100>" }

  has_many :item
  has_and_belongs_to_many :users
  belongs_to :category

  belongs_to :color
  belongs_to :icon

  # kaminari
  # https://github.com/amatsuda/kaminari
  paginates_per 6

end

class User < ActiveRecord::Base

  has_and_belongs_to_many :projects

end

Thank you for the help.

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to