search for: projects_users

Displaying 2 results from an estimated 2 matches for "projects_users".

2006 Jan 06
1
has_many with :finder_sql question
hi all, I have a Class, Client, which has_many projects (Project class). the projects depend on a session_id variable, however. So the question is, how can I do the following: has_many :projects, :finder_sql => "SELECT p.* FROM projects p INNER JOIN projects_users pu ON pu.project_id = p.id WHERE pu.user_id = #{session[:user_id]}" The problem is that I need to filter a client''s projects using a session variable, and the :finder_sql produces the error: "undefined local variable or method `session'' for Client:Class" I though...
2006 Dec 24
8
HABTM Reading Rows From Two Tables
...quot;projects", :force => true do |t| t.column "title", :string t.column "description", :text end # Users create_table "users", :force => true do |t| t.column "first_name", :string t.column "last_name", :string end # Projects_Users create_table "projects_users", :force => true do |t| t.column "project_id", :integer, :default => 0, :null => false t.column "user_id", :integer, :default => 0, :null => false end -------------------------- MODELS --------------------------...