Displaying 5 results from an estimated 5 matches for "membership_id".
2009 May 11
0
updating join table (HMT) with checkbox and extra fields
...ough => :memberships
...
class Membership < AR
belongs_to :user, :class_name => "User", :foreign_key => "user_id"
belongs_to :group, :class_name => "Group", :foreign_key =>
"Group_id"
...
Now, Membership table has an extra field called membership_id and I
want the user to fill in that id in the edit form.
My view looks like this. The checkbox fields works great and I can
update my db pretty well (barring minor issues).
<% form_for :user, @user, :url => { :action => ''save_memberships''} do |
form| %>
<%= form...
2007 May 17
1
has_one_or_many
...et working:
class Membership < ActiveRecord::Base
end
class Plan < ActiveRecord::Base
end
class MultiUser < Plan
has_many :users
end
class SingleUser < Plan
has_one :user
end
class User < ActiveRecord::Base
end
and then in my user table I would have a membership_id but no
plan_id...
I dont know quite much how to explain this better than by what I have
written above, ask questions if unclear. Thank you
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs...
2006 Nov 27
0
how to select with a kind of through relation(has_one)
...yield
end
end
end
create_table "items", :force => true do |t|
t.column "shop_id", :integer
....
end
create_table "shops", :force => true do |t|
t.column "user_id", :integer, :default => 0, :null => false
t.column "membership_id", :integer
t.column "expires_on", :date
t.column "enabled", :boolean, :default => true
....
end
create_table "users", :force => true do |t|
.....
end
create_table "memberships", :force => true do |t|
t.column "...
2008 Mar 14
5
Branching scenarios, GivenScenario and database
I''m trying to use stories to drive some high-level design.
I''ve got some branching scenarios where I want to follow a scenario,
to establish a base situation, and then have different scenarios which
''branch'' out from that state, possibly several levels deep.
I asked a bit about this a few days ago, and David pointed out the
rather undocumented GivenScenario
2006 Jul 26
8
team captain - habtm w/has_one...
the below...
class User < ActiveRecord::Base
has_and_belongs_to_many :teams
class Team < ActiveRecord::Base
has_and_belongs_to_many :users
has_one :captain, :class_name => ''User''
produces the error...
Mysql::Error: Unknown column ''users.team_id'' in ''where clause'': SELECT *
FROM users WHERE (users.team_id = 1) LIMIT 1
i