search for: count_record

Displaying 4 results from an estimated 4 matches for "count_record".

2006 Apr 27
12
how to do a count with a variable...
hi guys, got this problem... in my controller, when i wanna do a @temp.count it fails... then i went to try counter = @temp.count which also failed.. thus, i feel that the count is not available for ActiveRecord::Base..so i went to the Model class eg. user.rb so in user.rb : ... def count_uesr count = 0 self.each do |record| count ++ end return count end then it ended up having
2006 Jun 27
3
belongs_to <parent name>, :foreign_key modifier not working
All, I have two ActiveRecord objects. TargetList has_many Targets Targets belongs_to TargetList I''ve specified belongs_to :target_list, :foreign_key => ''DataSetID'' Queries generated by various methods in target_list do not seem to see the foreign_key name and keep trying to query my Target table using "target_list_id" (the default foreign
2010 Oct 11
8
Nooby Stuck - "has_and_belongs_to_many" relationship
trying to set up a "has_and_belongs_to_many" relationship would very much appreciate the help, not sure what im doing wrong at all. Scheme.rb class Scheme < ActiveRecord::Base validates :schemename, :presence => true belongs_to :user has_many :levels, :dependent => :destroy has_and_belongs_to_many :works end Work.rb class Work < ActiveRecord::Base
2008 Apr 13
20
uninitialized constant
Hi guys, I''m part way through a RoR application, for some reason whenever I add new controllers (using scaffold) I get an uninitialized constant [name of controller] error. The first few controllers work fine, the only thing I can see that I''ve changed is the layout file (but scaffold creates a new layout for each controller so can''t see that being the problem). You