On Viernes, 11 de Febrero de 2011 00:40:06 sp8786 escribió:
> I have two tables Project and Users, which have many-to-many
> relationship.
> I am displaying list of projects with option to edit members of
> projects.
> Currently I am able to support only adding existing users to project.
> But I want to add support for 'adding new users' as a link when
> displaying each project.
> 
> config.action_links.add 'create', :label => 'Create A New
> User',:parameters =>{:controller=>'user'},:page=>true

Which controller do you add that line in?

> 
> But upon clicking this link, project_id for which link was clicked is
> passed as constraint. Since user does not have any project_id column,
> I get following error
> 
> Malformed constraint `Userr#project_id'. If it's a legitimate column,
> and you are using a nested scaffold, please specify or double-check
> the reverse association name.
> 
> Here is my Model
> class User < ActiveRecord::Base
> has_many :join_user_project,
> 
>            :foreign_key => 'user_id'
> 
>   has_many :projects,
> 
>            :through => :join_user_project
> 
> end
> 
> class Page < ActiveRecord::Base
> has_many :join_user_project,
> 
>            :foreign_key => 'project_id'
> 
>   has_many :users,
> 
>            :through => :join_user_project
> 
> end

-- 
Sergio Cambra .:: entreCables S.L. ::.
Mariana Pineda 23, 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) [email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en.

Reply via email to