Displaying 20 results from an estimated 5000 matches similar to: "excluding column from associations"
2006 Nov 04
0
leaving a column out of an association
Is there a recommended way to exclude a column from associations? for example:
Model Album
has_and_belongs_to_many :photos
Model Photo
has_and_belongs_to_many :albums
Photo Table
int :id
int :order
blob :data <-- the culprit!
--------------------------------------------------------
I''m caching the output of Photo.data in a controller, but i don''t want
to select
2006 May 04
7
windows / migration issues
Running latest rails, etc on windows xp.
I can''t use "rake migrate" to migrate to latest version. I NEED to
specify, i.e. "rake migrate VERSION=11" for things to work
consistently.
plain ''ol "rake migrate" never makes it to the latest version. no
errors, she just stops short of the latest version.
hasn''t been a problem until now --
2006 Jun 19
0
1 RAILSCONF TICKET FOR SALE
Looking to get rid of a railsconf ticket. (face value)
Let me know if you''re interested.
Clint
--
clint troxel _ openEndStudios.com _ 307.413.0366
http://openendstudios.com
2006 Nov 14
16
memory issues -- mongrel part of the problem?
Hi. I''m a fairly new mongrel user and have a scenario that I wanted
to run by you all, see if anyone''s synapses connect -- mine def.
aren''t!
I''m running a fairly simple rails app through a mongrel cluster (2
mongrels). This site is consistently sloooow -- memory on the server
is regularly paging (and shouldn''t be). ssh-ing in and running top
shows
2006 Aug 16
3
Question RE Rails associations
Hi,
I am new to Ruby and Rails programming and am having difficulty with the
following scenario...
Consider the following model:
class Studio < ActiveRecord::Base
has_many :movies
has_and_belongs_to_many :actors
end
class Movie < ActiveRecord::Base
belongs_to :studio
has_and_belongs_to_many :actors
end
class Actor < ActiveRecord::Base
has_and_belongs_to_many :studios
2006 Aug 16
1
Naming rights_roles join model using has_many :through and polymorphic associations
Hi.
I have a couple of best practices questions regarding polymorphic
associations, naming join tables and user permissions.
Currently I have implemented the user authentication model from the
rails recipes book. Basically it goes something like this:
MODEL CLASSES:
class User < ActiveRecord::Base
has_and_belongs_to_many :roles
end
class Role < ActiveRecord::Base
2011 Jan 14
0
[Rail3] How to construct full-text search for habtm associations
hi all, i''m new to this group and currently using Rails 3.0.3 and meta_where
0.9.10.
i''m considering how to make a full-text searching feature to my project,
and my models, for example, should be defined like below:
class Group < ActiveRecord::Base
has_and_belongs_to_many :users
# :title (string)
end
class Comment < ActiveRecord::Base
has_and_belongs_to_many :users
2006 Feb 26
5
Help On Associations Extension.
Hi to all,
I''m needing some help here ... I want to do an extension on a
has_and_belongs_to_many to build a custom add method to the
association.
i have a table locations that has a many-to-many association with a
tags tabel using a locations_tags table.
i want to add a method to the Location has_and_belongs_to_many
association so that i can do something like this on the location
2006 Jan 06
6
HABTM problem not saving all associations
Hello all,
I have an Order object that has and belongs to many Products and has
and belongs to many Loan Types. This is so I can select multiples of
each in my order entry screen via checkbox groups.
I''m having some trouble with saving multiple HABTM associations for a
single model object; only the first HABTM association declared in the
model will save during the initial @order.save
2006 Jun 14
3
Prevent duplicate HABTM associations
Hi,
I am trying to restrict duplicate has_and_belongs_to_many associations.
I tried to find support for a association validation for duplicates but
couldn''t find anything.
I understand I could use :uniq=>true on the model association but this
would only prevent it from displaying duplicates, I want to stop
duplicate associations being inserted in the first place.
I have a vague
2006 Jun 22
0
Active record associations
I have a table containing a person''s info:
Person
{
first_name : string
last_name : string
height : int
weight : int
age : int
}
This person can belong to many leagues and 0 or 1 teams within that
league. I can create join tables and use the following associations:
League has_and_belongs_to_many people
Team has_and_belongs_to_many people
League has one
2006 Jan 15
2
new objects and new associations in same view
Hello All,
I generated scaffolding for my Users table and setup my additional
models with their associations. I want to be able to create a new user,
and its associated groups and privileges from the same view. My
relationships are as follows:
users:
has_and_belongs_to_many :groups
has_many :privileges
groups:
has_and_belongs_to_many :users
privileges:
belongs_to :user
Right
2012 Sep 04
5
Associations and Math between Models
I''ve setup two models, 1 and 2, that are associated by
has_and_belongs_to_many. I''m trying to get an attribute from model_1 to use
in a method in model_2. When I use the code below, I get an error saying
''undefined method model_1_id''. What am I missing? Thanks!
Model_2.rb
Class Model_2 < ActiveRecord::Base
...
has_and_belongs_to_many :model_1
def
2006 Apr 14
1
ActiveRecord and multiple associations
Hello,
I have a Company that has_and_belongs_to_many Persons. A Person
has_many Emails. I want to display each Person''s Email for each
Company, so I try this:
companies = Company.find(:all)
for company in companies
persons = company.persons
for person in persons
puts person.email
end
end
Unfortunately, this doesn''t work correctly. Let''s say the id of
2012 Sep 08
3
Polymorphic has_and_belongs_to_many association
Hi,
I''m currently having the situation where I have to implement a polymorphic
has_and_belongs_to_many by introducing an in between model that handles all
the "has_many :as" and "belongs_to :polymorphic" association
implementations... and is not doing anything else. Thing I don''t like it
here is, I am unnecessarily loading AR instances only to execute SQL
2008 Jan 15
1
actionmailer the background
I have bdrb successfully set up and running in a local project. It''s
doing two things:
1) processing large csv files and using ActiveRecord to insert
2) sending large batches of emails using ActionMailer
In development both work well. I see my ActionMailer emails in the
log (though it''s the development.log -- odd?)
On the production server csv processing works well, but
2011 Apr 16
0
adding HABTM association while creating a record
Hello Experts,
I have a HABTM association as followed:
class Account < ActiveRecord::Base
has_and_belongs_to_many :user
end
class User < ActiveRecord::Base
has_and_belongs_to_many :type
has_and_belongs_to_many :account
end
class Type < ActiveRecord::Base
has_and_belongs_to_many :user
end
I have the following query;
I Have a parent user who is creating another user under its
2006 Jan 12
2
Finding by association
I have two objects that are associated in the following way:
class Class1 < ApplicationController
has_and_belongs_to_many :class2s
has_and_belongs_to_many :otherClasses
end
class Class2 < ApplicationController
has_and_belongs_to_many :class1s
has_and_bleongs_to_many :otherClasses
end
Now, when I run the following query,
@objects = Class1.find(:all, :conditions
2005 Dec 15
2
HABTM being tricky
I''ve just been bodyslammed by a problem with has_and_belongs_to_many -
as far as I can tell, if it doesn''t appear at the top of other
relationship definitions it doesn''t seem to work right. For example:
class Artist < ActiveRecord::Base
has_and_belongs_to_many :genres
has_many :albums
has_many :videos
has_many :cds
has_many :collections
end
..works fine
2006 Oct 02
0
list of methods derived from associations?
Hello;
I''m at this point essentially a Rails hobbiest: entranced, enthralled,
immersed but not writing Rails apps commercially. I am sure my question
has been asked and answered but I searched and couldn''t find it, so....
Is there somewhere a list of methods that become available via
associations? I was doing a project with acts_as_tree and was struggling
with a breadcrumb