similar to: Relating Namespaced Models

Displaying 20 results from an estimated 400 matches similar to: "Relating Namespaced Models"

2006 Apr 06
4
Record retrieval in Many-to-many using :through not working
Hello, I get an error while retrieving records from the following model structure. Tables foods - id, food foodallergies - food_id, symptom_id, a few other columns symptoms - id, symptom Models class Food < ActiveRecord::Base has_many :foodallergies has_many :symptoms, :through => :foodallergies end class Symptom < ActiveRecord::Base has_many :foodallergies has_many :foods,
2006 Mar 27
2
:through and STI
Hi, I''m trying to use :through and STI using the trunk version of Rails, but I get the following error see bottom of this msg[1] here are my classes. class Player < ActiveRecord::Base end class Ladder < ActiveRecord::Base has_many :subscriptions has_many :players, :through => :subscriptions end class SingleLadder < Ladder end class Subscription <
2007 Aug 15
2
has_many :through ... What am I missing?
class Ladder < ActiveRecord::Base has_many :players has_many :users, :through => :players end class Player < ActiveRecord::Base belongs_to :users belongs_to :ladders end class User < ActiveRecord::Base has_many :players has_many :ladders, :through => :players end When I try the following code (on the console) I get an error: @ladder = Ladder.find(1) @ladder.users I
2008 Nov 03
0
acts_as_rateable in rails 2.2.0
Hi all, I have a problem with acts_as_rateable in rails 2.2.0. [code=]ActionView::TemplateError (uninitialized constant <#object>::Rating) on line #10 of app/views/blah/blah.html.erb: /Library/Ruby/Gems/1.8/gems/activesupport-2.2.0/lib/active_support/dependencies.rb:102:in `const_missing'' /Library/Ruby/Gems/1.8/gems/activerecord-2.2.0/lib/active_record/base.rb:2042:in
2006 Dec 20
4
undefined method `fullname' for #<User:0x357e380>, BUT works on first view?
Hi all, Please excuse the long post, but I wanted to make sure you have all the information.... I have a NewsModel that looks like this: class News < ActiveRecord::Base belongs_to :user validates_associated :user validates_length_of :title, :description, :minimum => 5, :allow_nil => false acts_as_commentable acts_as_taggable def self.find_recent News.find(:all,
2006 Nov 26
5
associations help?
I have Users who can "own" Projects. There is only one owner. Users in general can be authorized to view certain projects. Here is my initial stab at this: class User < ActiveRecord::Base has_many :projects # ownership has_many :project_viewers, :dependent => :destroy has_many :projects, :through => :project_viewers, :uniq => true ... end class
2007 May 24
3
Annoying problem, stack error
For some reason rake spec is totally crapping out on me. I don''t know what I did to make it break, the only thing I tried new was install haml, but even after removing it there is still a stack trace. Here is what I am getting- sparta at phalanx ff $ rake spec (in /Users/sparta/Projects/work/idastudios/ff)
2007 May 30
2
ActionView::TemplateError
Hi, I have a strange problem that only occurs on the production server. I''ve been banging my head for hours trying to figure it out with no success. Below is a copy of the error from the production log. ActionView::TemplateError (Expected /www/rails_apps/scanlan/current/ public/../config/../app/models/image.rb to define Image) on line #6 of app/views/admin/design/_record.rhtml: 3:
2008 Jul 08
0
Bug with serialized columns in console ?
Hi, I recently added 2 serialized columns in my class Server : class Server < ActiveRecord::Base serialize :visa, Hash serialize :appli, Array ... No problem in my controller and my application and everything works as expected : Excel exports following the "visa" Hash or "appli" Array are ok. But since I added the visa Hash, I can''t load the record with
2006 May 20
1
acts_as_paranoid overrides ActiveRecord::Base??
Guys, I am trying to figure out what exactly does this line do at the end of "acts_as_paranoid" plugin? ActiveRecord::Base.send :include, Caboose::Acts::Paranoid::ActiveRecord My problem: I have some classes that I use acts_as_paranoid, and others with tagging support. Classes declared as taggable, throw error, which appears to be in the acts_as_paranoid version of the
2006 Jun 06
0
Scaffolding Extension - Polimorphic Associations
When I try to use it with polimorphic associations I get the following error In browse action: activesupport-1.3.1/lib/active_support/dependencies.rb:100:in `const_missing'': uninitialized constant Privable activerecord-1.14.2/lib/active_record/base.rb:1246:in `compute_type'' activesupport-1.3.1/lib/active_support/dependencies.rb:131:in `const_missing''
2008 Oct 16
5
2 Models: Same name, different namespace => Problems
Let''s start with an example: --- class Comment < ActiveRecord::Base end # dummy (to invent a "table namespace") class Review < ActiveRecord::Base end # ... dummy # is "review_comments" in the database class Review::Comment < ActiveRecord::Base belongs_to :thing end class Review::Thing < ActiveRecord::Base has_many :comments, :class_name =>
2006 May 05
1
Help with ActiveRecord
Model: class AdminQueue < ActiveRecord::Base set_table_name ''adminqueue'' end Interacting with it in script/console >> AdminQueue.new => #<AdminQueue:0x240a910 @attributes={"topic_id"=>nil, "resolved"=>nil, "updated_on"=>nil, "action"=>nil, "type"=>nil, "post_id"=>nil,
2011 May 07
4
Activerecord::JDBCError: Invalid column number
Hi, I''m rather new to Ruby and RoR, so I do not really know whether this ist the right forum to place my question. For my first ''project'' I planned to create a simple online-viewer, which grabs data from an existing database and make them visible in a structured form via browsers. So I thought that could be the right beginner-project, because I have only read datasets
2007 Nov 29
4
collection.build or collection.create gives "ArgumentError: wrong number of arguments (1 for 0)"
I have a Project that has_many Tasks. Tasks belongs to a Project. When I try the following: project = Project.new project.tasks.build I get: >> s = Project.new => #<Project:0x25f9e28 @attributes={"name"=>"", "end_at"=>nil, "updated_at"=>nil, "published_at"=>nil, "user_id"=>nil,
2007 Jun 01
0
"Exception: stack level too deep" on collection.clear?
Without getting too deep into my app I''m wondering if anyone has any clues what might give rise to the error posted below. It occurs when I run my unit tests. class Actor < AR:Base belongs_to :court_case end class CaseCause < AR:Base belongs_to :court_case end class CourtCase < AR:Base has_many :actors has_many :case_causes ... end def my_test_method ...
2006 Jul 08
1
Need Help Understanding Situation with Table Columns
I am trying to create an application loosely based on the Depot application presented in Agile Web Development with Rails (AWDwR). I am using InstantRails for the server. In my app I have the folowing controllers: admin_controller application_controller city_map_controller (with method: displayGMap) The admin_controller was created with the following command: ruby script/generate scaffold
2009 Sep 09
0
Rails 2.3.4 ActiveRecord association problem
Upgraded our app from Rails 2.2.2 to 2.3.4, and I''m now encountering an error when adding a child to a parent. Top of the stack: wrong number of arguments (1 for 0) /Library/Ruby/Gems/1.8/gems/activerecord-2.3.4/lib/active_record/ associations/has_many_association.rb:61:in `save'' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.4/lib/active_record/
2007 Jul 19
7
NoMethodError in partial driving me mad
Hello, i simplified have a news model, a news category model and a news controller. my _news.rhtml partial renders a single news entry. in my controller there are the actions show and show_category. if the "show" action is called, a single news item is rendered through my partial with no errors. if the "show_category" action is called, i get a NoMethodError while displaying
2006 Dec 14
3
Problem with ActiveRecord and Associations
Hi, I''m having what I believe to be a typecast problem with ActiveRecord and Associations. In the code below, I need to flag a contact record for deletion if the contact doesn''t have any addresses or books records: sql = "select id, delete_flag from contacts where id = #{params[:id]}" contact = Contact.find_by_sql(sql) if (contact[0].addresses.count +