Unless you've changed the underlying models, this WON'T WORK. I  
seriously doubt that the users table has a project_id key.

Here's a correct set of associations:

project:
has_many :timesheets
has_many :users, :through => :timesheets

timesheet: (note: there must be correct FK fields here - make sure  
that timesheets.project_id and timesheets.user_id exist!)
belongs_to :project
belongs_to :user, :creator => true

user:
has_many :timesheets
has_many :projects, :through => :timesheets

And your auto_actions_for call is in the wrong place, on further  
inspection.
It should be in the TimesheetController, declared as:

auto_actions_for :project, :new

This will create a new route, 'new_timesheet_for_project', and route  
to the action new_for_project on TimesheetController.

--Matt Jones



On Jun 18, 2009, at 2:26 PM, hobo_hippy wrote:

>
> er, well, I did catch that. got rid of the :through so it's user
> belongs_to project and project has_many :users, :through
> => :timesheets
>
> project
>  has_many :timesheets
>  has_many :users, :through => :timesheets
>
> user
> has_many :timesheets
> belongs_to :project
>
> timesheet
>  belongs_to :user
>  belongs_to :project
>
> still won't let auto_actions_for work..
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Hobo 
Users" 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/hobousers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to