Displaying 6 results from an estimated 6 matches for "club_id".
Did you mean:
cb_id
2005 Oct 26
2
validates_associated ... doesn't
Hi,
I think I''m missing some fundamental information here so hopefully
someone can help me. I have a model Club which has many members,
members of course belong to a Club. I''d like to ensure that when a
members is saved (saved/created/updated) only valid club_id''s are accepted.
I have a Club model (simplified) like this:
class Club < ActiveRecord::Base
has_many :members
end
I have a Member model (simplified) like this:
class Member < ActiveRecord::Base
belongs_to :club
validates_associated :club
validates_pre...
2006 Mar 13
3
HABTM: two habtm''s between the same two tables
Imagine I want to track people, and the clubs that they belong to.
table people with columns person_id, person_name
table clubs with columns club_id, club_name
And I have the association table:
table clubs_people with columns person_id, club_id
Now I know how to do this habtm between the two, in order to associate
people with clubs that they belong to.
However my application also needs a secondary association just like
this: imagine I wan...
2007 Feb 24
0
after_create not creating the right object
I have 2 tables... club and forum, which use the "type" as I''m
subclassing the Club and Forum objects. Tables are:
clubs:
id
title
type
forums:
id
club_id
title
type
I''ve put an "after_create" callback in the Club as Club has_one Forum:
class Club < ActiveRecord::Base
after_create :create_forum
has_one :forum
def self.create_forum
# create it (taken from console)
@f = Forum.new(:title => ''Forum'&...
2008 Mar 07
3
Boolean circles..
...uot;>
>> m = c.members.find(:first, :conditions => "is_active = 1")
=> nil
>> m = c.members.find(:first, :conditions => "is_active = true")
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such column:
true: SELECT * FROM members WHERE (members.club_id = 1 AND
(is_active = true)) LIMIT 1
from /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:150:in
`log''
from /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/sqlite_adapter.rb:132:in
`execute'...
2008 Sep 24
19
How to define request.domain in when testing
Hi,
My application relies on request.domain for doing its job. The problem I
am encountering, is that when running tests, request.domain returns
"test.host", how can I change that so that it returns "mysite.com"?
Thanks in advance.
--
Posted via http://www.ruby-forum.com/.
2008 Mar 07
2
Trouble using RESTful helper
..."Edit", edit_member_path(member.club, member) %></td>
42: <td><%= button_to "Deactivate", member_path(member.club,
member), :method => :delete %></td>
43:
The index action of the controller is just:
def index
@club = Club.find(params[:club_id])
@members = @club.members.find(:all, :conditions => ["is_active = ?",true])
@term = get_term
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @members }
end
end
I can use the same code from the console ok, so the model...