similar to: Edge Rails Nested has_many :through Association

Displaying 20 results from an estimated 30000 matches similar to: "Edge Rails Nested has_many :through Association"

2006 Jun 19
2
const_missing error of has_many through association
Hi, I am new to ruby on rails. I am building an association join model and encountered the following error. Does anyone know what am I missing? > NameError in StartController#home > >d:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:100:in `const_missing'': uninitialized constant Membership I have the following tables relationships Users
2009 Mar 13
1
Problem saving nested attributes for has_many associations (Rails 2.3 RC2 and Edge)
I''ve tested this on both 2.3 RC2 and Edge. This pastie contains model, helper and view: http://pastie.org/415742 When I save a vocabulary - its terms don''t save. I''m fairly sure it worked in RC1. Would appreciate any insight. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on
2014 Apr 06
0
collection_check_boxes with has_many through: association Rails 4
I am trying to list all the categories a user can be interested in with check boxes so that a user can submit these interests through my join table. collection_radio_buttons works with a simple has_many, belongs_to association: <%= collection_radio_buttons(:listing, :category_id, Category.all, :id, :name do |b| %> <%= b.label { b.radio_button} %> <%= b.text %>
2009 Apr 12
0
rails 2.3 nested forms with has_many through checkboxes
I was wondering if anyone knew of a way to combine the new nested forms in rails 2.3 with a has_many through relationship via checkboxes. Basically I have a page model, a page_category model and a category_items join table. Pages have many page categories through category items. The category_items table is polymorphic so i can use it for other models who need categories (maybe this is
2006 Jan 26
2
Rails Edge stability - has_many :through
Hi all, If I was to start developing an application using Edge Rails with the view to deploying on Rails 1.1, would I fall foul of lots of bugs, or is it relatively stable? I''d really like has_many :through relationships, to save me dealing with HABTM + associations. Thanks, Tom
2006 May 04
0
Complement set association to has_many/through?
I have two models, A and B, with a straightforward many-to-many has_many/through association between them. So, in A I have the association processed_bs and in B I have processedby_as. This works fine. Now, I would like to also have an association unprocessed_bs in A, which holds all Bs that _aren''t_ in processed_bs. I can write a method in A that returns all those objects as a list
2006 Feb 11
6
Rails Edge, has_many :through in searches
I have two tables, a Projects table and a Clients table. It''s basically a HABTM relationship, but I have additional project/ client-specific information in the join table. I''m trying to use the new has_many :through method to join these. It works fine when displaying records, but when I try to search, I''m having this problem: When I used a HABTM model to search
2006 Jul 31
0
Polymorphic has_many association through a belongs_to
Hi, Let''s say I''ve the following Models and their relative associations: Seat ---- belongs_to :booking Booking ------- has_many :seats has_many :debits, :as => :chargeable Debits ------ belongs_to :chargeable, :polymorphic => true Why >> seat.booking.debits nil while >> Booking.find(seat.booking_id).debits [] ? Thanks. Cheers, Marco
2006 Jun 22
0
how to save objects in a has_many :through association?
(I posted this yesterday but it never showed up on the mailing list... weird.) I recently converted a habtm relationship into one using has_many :through. Some of my old logic relied on the ability to use the #<< operator to add items to the relationship and get them auto- saved. I''m curious to know the best way to do the same operation with the has_many :through
2007 May 22
3
can I use acts_as_list with a has_many :through association
I''d like to be able to use a has_many :through association and treat the associations as a list but I''m getting this error when I try an use an acts_as_list method: NoMethodError: undefined method `move_to_bottom'' I''m using edge rails r6786. Here are my domain rules: Activities are things students can do. Units consists of a sequenced list of
2010 Jan 27
2
has_many, through with nested models?
First the data model: class Forum < ActiveRecord::Base has_many :topics, :dependent => :destroy, :order => ''created_at desc'' end class User < ActiveRecord::Base has_many :topics, :dependent => :destroy has_many :comments, :dependent => :destroy has_many :replies, :dependent => :destroy end class Topic < ActiveRecord::Base belongs_to
2007 Dec 20
0
polymorphic has_many :through Vs Inheritance
Hi everyone. Ive part of a project that I need to refactor, and im having some difficultly deciding which path to take. Perhaps someone can help, I think its primarily a design question. A Spec consists of many Nests and many Parts. Nests contain Parts. Here''s what I have, which works well currently: --------------------------------------------------- class Spec <<
2013 Jul 21
4
how to use activemodel collection.build for a has_many :through association
Hi all, In my controller I am doing the following to populate a nested form for a has_many through association: def new @specification = Specification.new Component.find_each.each do |component| @specification.component_specifications.build(:component_id => component.id) end The idea being whenever someone creates or edits a form, it will be populated with all
2006 May 05
0
Missing documentation for find_in_collection? Trying to drill down in a 4 level has_many association fails
I''ve been reading up in ActiveRecord::Associations and playing around with my app via the console and found some interesting methods via the code completion of IRB, but I have no idea how to use them and can only find one hint in the API http://api.rubyonrails.com/classes/ActiveRecord/Associations/ ClassMethods.html It mentions here in the has many associations that if you use the
2009 May 27
0
Nested Forms with has_many associations with validations
I want to have a parent model that I can add child objects (via a has_many association) using the rails 2.3 nested form syntax. However, it seems like rails throws an error during validation of the parent model if I have a validates_presence_of :parent_id defined in the child model. Is the only solution to this to remove the validates_presence_of :parent_id? This seems like a hack-ish workaround.
2006 Mar 24
2
Change to has_many :through associations
Hi everyone. I''ve made a default change to has_many :through associations that I felt was important to make before they''re released. This is after some tickets and confusion I''ve seen regarding has_many :through. class Connection < ActiveRecord::Base belongs_to :user belongs_to :channel end class Channel < ActiveRecord::Base has_many :connections
2006 Aug 03
12
More than one has_many :through association between the same 2 models
I wonder if you can have more than one has_many :through association between 2 models. For example... I have a model Teacher and a model Class Now, 1 Teacher works in many Classes, right?. So I need a join model like class Work < ActiveRecord::Base belongs_to :teacher belongs_to :class end But I also would like to know if a teacher CAN teach a class before I
2013 May 22
3
rails 4, active record: appending to has_many :through does not create join model anymore?
hi folks. on rails 4, can somebody confirm that pushing model instances onto a has_many :through relation does not create the necessary join model anymore? class Reader < AR::Base belongs_to :post belongs_to :person end class Post < AR::Base has_many :readers has_many :people, through: :readers end @post.people << Person.new so,
2012 Jun 18
0
Creating an object with a nested has_many :through relationship
I have 3 models that define members, groups and the subscriptions: Member, Group, and GroupMember. class Member < ActiveRecord::Base > has_many :group_subscriptions, class_name: "GroupMember" > has_many :groups, through: :group_subscriptions > attr_accessible :email, :password > end > class Group < ActiveRecord::Base > has_many :member_subscriptions,
2006 Apr 04
1
Manipulating has_many :through associations
Hi, I haven''t done any associations before, so please forgive my incorrect use of terminology... If I set up a has_many :through association, can I manipulate the associated instances directly (like an Array), or do I need to manipulate the join model? For example, suppose I have two classes and the associated join model: class foo has_many :foo_bars has_many :bars, :through