search for: hasandbelongstomanyassociation

Displaying 5 results from an estimated 5 matches for "hasandbelongstomanyassociation".

2006 Jan 25
2
Update join_table attributes
...columns in the join table using update_attributes. This is a well documented shortcoming, and the solution everyone talks about is to override the update_attributes code. The code (see the comments @ http://tinyurl.com/ey5qd) starts like so: module ActiveRecord module Associations class HasAndBelongsToManyAssociation def update_attributes(record, join_attributes = {}) The problem is, and here is why I''m writing, that this code isn''t called when you call update_attributes. In fact, if you go and edit the file that defines HasAndBelongsToManyAssociations and you put in a method "fo...
2006 Aug 18
9
Rails is doing what I want - but I don''t understand how.
Hi guys, I have the strangest thing happening. The funny part is its doing exactly what I want to do, I just don''t understand how. Basically here is my model. class Role < ActiveRecord::Base has_and_belongs_to_many :users has_and_belongs_to_many :rights def self.names names = Array.new() for role in Role.find :all names << role.name end return
2005 Dec 05
1
Lack of 'LEFT JOIN' in Oracle 8, any patch for theta style (+)
...e.fname, e.lname, j.jobdesc FROM employe e, jobs j WHERE j.job_id (+) = e.job_id JOIN syntax came with 9i. Anyone patched Rails source for supporting that (+) ''theta'' style ? I''m using 8.1.7 and LEFT JOIN is builded into class HasAndBelongsToManyAssociation to provide HABTM Thanks! -- Mathieu
2006 Jan 29
9
Specify options with habtm
Hi all I have the following models: class member has_and_belongs_to_many :disc_jockeys end class disc_jockey has_and_belongs_to_many :members end The relation table is called disc_jockeys_members and has the following fields: disc_jockeys_members(disc_jockey_id, member_id, status) So far, the field status can have values like valid, invalid, locked etc., but it is not regarded yet by
2006 Jan 09
4
Problem with habtm and resulting SQL insert
Cheers, I have a problem with 1.0 and a habtm relationship between User and Article. I want to save all articles that users read. I have these models: class User < ActiveRecord::Base has_and_belongs_to_many :read_articles, :class_name => "Article", :join_table => "read_articles" ... end class Article < ActiveRecord::Base has_and_belongs_to_many :readers,