similar to: rails 4, active record: appending to has_many :through does not create join model anymore?

Displaying 20 results from an estimated 10000 matches similar to: "rails 4, active record: appending to has_many :through does not create join model anymore?"

2009 Feb 21
3
belongs_to or has_many
2 tables Items and Categories Categories (id, name) Items (id, name, category_id) Category_id can be null, and there are Categories that has not an Item. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email
2011 Aug 12
1
Getting nil value when setting an on Join model via a has_many :through relationship
Hi All, I''ve been trying to figure out what''s wrong here for a little over a day and figured i''d reach out to the ROR list. A pastie explains the code a bit better than directly in email: http://pastie.org/private/mvu0zr1xm18bsk6nfbyama Basically i have an Artist, and he has many Songs through a join model called Releases. An artist can be "featured" on a
2006 Dec 05
4
has_many with :uniq not working for me
Hi all, I have a relationship (no really!) class RiskMatrix < ActiveRecord::Base has_many :severities, :order => :position, :uniq => true end class RiskFactor < ActiveRecord::Base belongs_to :risk_matrix validates_presence_of :descriptor, :example validates_uniqueness_of :descriptor, :example, :scope=> :risk_matrix_id end class Severity < RiskFactor
2006 May 10
7
has_many :through scope on join attribute
Hi I have a has_many :through. It''s a basic mapping of Project id .... User id .... TeamMembers project_id user_id role What I would like to do is have different roles so I can have in the project model has_many :core_members, :through => :team_members, :source => :user but I would like to limit this to only those with the "core" role in the team members table for
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
2011 Nov 24
4
How do I destroy all the posts when the board is destroyed?
I got a application like following. A board has many posts All posts belong to a board I try to destroy all the posts under a board when I destroy the board. My destroy function is following. def destroy @board = Board.find(params[:id]) @post = @board.posts @post.destroy @board.destroy respond_to do |format| format.html { redirect_to(boards_url) } format.xml
2012 May 27
3
Dumb question
Folks Can a model just have a belongs_to only? or do you have to have a belongs_to and a has_many or has_one on the other model? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To
2013 Nov 30
1
Need good tutorial on ActiveRecord associations
Hi, I am very new to rails.. I am having hard times to understand the ActiveRecord associations.. I tried http://guides.rubyonrails.org/association_basics.html .. But it is not for beginners. :) Is there any good tutorials, to understand the concept? Thanks -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on
2009 Apr 24
1
RoR - getting started with database relations
Hey everyone... I''m just getting my feet wet with relational databases using RoR models. The software I''m putting together relies on car parts. Originally I had the database set up as follows create_table :parts do |t| t.column :year, :string t.column :make, :string t.column :model, :string . . . end However, I now realize it''s much better to do it using
2009 Jun 27
6
User has many topics or subtopics
Hi, So i have users in the system and i have topics. Topics also have_many subtopics. What is the cleanest way to setup the AR relationships if a user can either have_many topics or subtopics ? Its basically a dual select box dropdown, where the second dropdown is optional. Is the best to have user_topics, and user_subtopics tables and manage that way ? or combine into one table with STI
2008 Jun 07
5
Can create record but can not update it => has_many through
Hi All, I have a problem using has_many through association. I can create a product without problem, but when i edit it, i got this NoMethodError: undefined method `reciters='' for #<Product:0xb71a77e8> Did i miss something to code? I provided the codes below. Please help Thanks, Dida product_controller.rb ====================== def create @product =
2011 Oct 11
10
Create Two objects at the same time
I have user model and referral model. Referral model has user_id as field. Now when a new user is created, I need to call referral#create as well and pass it the id of the newly generated user to user_id of referral model. How can I do that. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to
2009 Nov 12
0
Problem with has_many :through, :uniq => true with polymorph
Didn''t have quite enough space to describe it there...basically i''m having a problem with the :uniq option in my tags. I''m using acts_as_taggable_on_steroid which adds these associations to my Resource class: Resource has_many :taggings, :as => :taggable, :dependent => :destroy, :include => :tag has_many :tags, :through => :taggings, :uniq => true
2006 Apr 20
3
has_many :through with has_many/has_many join models
It seems that using a join model that joins with two has_many''s will fail to generate proper SQL class StudentSemesterRecord < ActiveRecord::Base belongs_to :semester has_many :discipline_records, :through => :semester end class Semester < ActiveRecord::Base has_many :student_semester_records has_many :discipline_records end class DisciplineRecord <
2006 May 26
3
Breakdowns in has_many abstraction
I discovered an interesting aspect of has_many behavior that I''m struggling to work around. I''m not sure if I''m doing something wrong, or if it''s a legitimate bug, or if it''s an inherent part of Rails that I just have to learn to deal with. It boils down to these two problems: - changes in collection objects (i.e. models that belong_to a container
2007 Oct 18
0
Getting the through items from a has_many :through :uniq relationship
Getting the through items from a has_many :through :uniq relationship In a nutshell, I have been using the has_many :through :uniq relationship, and I want a DRY way to list the join model objects. Currently, my objects include taxon objects, toxin objects, data_object objects, and taxon_toxin_citation objects ("citation" is another word for data_object). A taxon has many data objects,
2006 Jul 23
4
has_many AND has_many :through ?
Hi, I am working on a scheduling app and I have a perpelextion (new word). I am wondering if the problem is my data model I have Users. Users can create Events. Users can be invited to Events created by other Users. So... user.rb class User < ActiveRecord::Base has_many :invitations # invitations to other users'' events has_many :events, :through => :invitations # all events
2009 May 12
2
STI good or bad for my problem?
Hi. I am currently developing a small course system for student and teachers. The system is divided in sections and sections have many messages, comments, documents and schedules. Pretty easy to set up using ROR, just add some belongs_to and has_many relations. But everything becomes much more complicated when the section items (message, comment and so on...) all has comments. And they can also be
2012 Aug 13
10
Question about PATCH method, accepts_nested_attributes_for, and updates to association lists (has_many, HABTM)
Am interested in the new PATCH method that will be included in Rails 4, but have a question/concern, and forgive me if I''m misunderstanding it. So, if the request parameter _method is set to "patch", the update is processed as a patch. But, let''s say you have a model called Airplane and Airplane has a collection of FlightCrewMembers which it
2007 Dec 11
2
Patch 10463: has_many through using uniq does not honor order
Hi, I''ve just submitted a patch for ActiveRecord; http://dev.rubyonrails.org/ticket/10463 The patch includes new fixtures because I could not find a applicable combination among the existing fixtures. I hope that''s okee. Please +1 or comment it. Thanks, Remco --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the