similar to: has_many :through extra domain model question

Displaying 20 results from an estimated 9000 matches similar to: "has_many :through extra domain model question"

2006 Jul 10
10
has_many :through and foreign key parameters
I just took my HABTM and turned it into a :through since my join table has another "non-joiny" attribute. I went from this: has_many_and_belongs_to :jobs, :join_table => ''tablename'', :foreign_key => ''x'', :association_foreign_key => ''y'' to this: has_many :jobs, :through =>
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
2006 Feb 10
4
Handling a relationship between users and newsletter subcriptions.
Hey Everyone! I have a newsletter system that contains a multitude of different newsletters. In this case three but the system allows the user to add more. Every user can be subscribed to any amount of given newsletters. So what I did was I created a user model, newsletter model, and subscription model. The subscription model belongs to one user and one newsletter. However,
2018 Feb 02
6
Slightly OT : newsletters, mail formatting and netiquette
Hi, This question is not exactly CentOS-related strictly speaking, but here goes. I'm running a few newsletter servers for myself and a handful of clients on public CentOS servers with PHPList. For the last twenty years or so I've followed the basic rule that mails should have no formatting whatsoever, only simple text. And now I wonder if that basic rule of netiquette also applies to
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 <
2009 Jul 11
5
Firefox 3.5 Issues
I downloaded Firefox 3.5 from the M. Harris site and, for the most part, have had good luck with it. But I have also had hard crashes that take down CentOS, not just Firefox. It happened to me twice on eBay (on the same page) -- and now I can replicate it as many times as I want by going to... http://wiki.centos.org/Newsletter ...and choosing one of the two newsletters, linked there. I'm
2006 May 21
3
has_many :through with a polymorphic join
Hi, Four tables: users, user_counties, uk_counties and us_counties. Each user has many counties, and each county has many users, so I decided to make user_counties a polymorph, so it can have counties from different countries (each country requires a completely different set of tables with a completely different set of properties, that''s why there''s one table for uk_counties and
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
2007 Mar 06
2
need to create a NewsLetter Funtionality in RoR
Hi, Me a newbie in RoR - switching from .NET. i want to write an application that has a newsletter functionality where I can create an interface where in I can have options to send newsletters to multiple people in the database. i need to make a form which has from hardcoded, to is selected from te database maybe a listbox next to it and then a subject and text area. how wud i go about doing
2006 Jul 28
8
mass emails
Say we have 20k-50k users signed up for an email newsletter. Does anyone have any data on how well ActionMailer does with mass emails? How long would that take to send? Anything I should watch out for? Thanks, Joe
2006 Jul 28
2
has_many :through with multiple paths
Hi all. I am currently thinking about how to do the following: I have the following models. Team Person Team has various positions (manager, programmer etc.) I would like each one of those positions to reference one or more Person records. A single Person record could be on 6 different teams at the same time in different roles. the same person could even be on the same team multiple times
2006 Jun 08
3
has_many :through updates on delete.
I have a model that looks like this: class Actor < ActiveRecord::Base has_many :member_groups, :foreign_key => ''member_id'', :class_name => ''GroupMember'' has_many :groups, :through => :member_groups, :source => :group end class Group < Actor has_many :group_members, :foreign_key => ''group_id'',:dependent =>
2006 May 23
7
self-referencing has_many
Having a devil of a time finding records in a self-referencing has_many table relationship. Everything is working find looking at the has_many and the belongs_to relationship. But, when I try to find all "orphans", records that are neither a parent nor a child, I can not find a query that work in ActiveRecord. This query works in MySQL: SELECT * FROM templates LEFT JOIN templates
2006 Aug 12
7
Collection assignment to a has_many :through
I''m working on a simple photo gallery in rails, it seems to be a good project for a newbie. I have photos and categories, many-to-many association. It worked well with HABTM. Then I decided that it would be good to be able to change order of the photos so that thumbnail pages would look less chaotic. So I created a Layout model which is a join model (or whatever it is called) that
2014 Mar 11
2
More wiki access, please
Howdy - Was trying to revive the CentOS Newsletter and went to edit this page: http://wiki.centos.org/Newsletter/Contributing And was told I don't have access. Can I get access to that page / pages related to the Newsletter, please? Thanks! jzb -- Joe Brockmeier | Principal Cloud & Storage Analyst jzb at redhat.com | http://community.redhat.com/ Twitter: @jzb |
2006 Jul 04
2
has_many working correctly only on reload!
I have this code that is using svn externals with rails EDGE working fine for the past couple of months. A couple of days ago, this code died. Even after deleting vendor/rails, this code doesnt work: class Tag < ActiveRecord::Base has_many :taggings has_many :events, :through => :taggings has_many :users, :through => :taggings end class User < ActiveRecord::Base # Virtual
2006 Jul 10
7
What is has_many :through really buying you over HABTM?
So having just learned how to do has_many :through as opposed to HABTM, and then, being concerned that I wouldn''t get it to work, I started thinking about these two approaches. It seems to me that the _only_ problem that the HM:T (has_many :through) approach solves that HABTM doesn''t is the issue of the potential collision of id columns between your join table and one of
2009 May 31
3
Proposal for standardized mugshots
Hi, The first issue of the newsletter is being finalized to be released on Tuesday. For this we wanted to personalize the content a bit (and also credit contributions) by adding mugshots when we report about people and/or get contributed content. To facilitate this, we need a standard to refer to these mugshots and for this I'd like to propose the following convention for everyone who
2006 Jul 10
18
Deleting join association of has_many :through
I''m trying to use has_many :through, since my join model deserves being more than just an intersection table. But when I try to break the association, the break only seems "temporary": Let''s say my two tables are Users and Colors, and the join model is Favorites. user = Users.find(1) user.colors.length >> 2 c = user.colors.first >> #<Color:....>
2006 Apr 04
4
Threads vs. Processes and Rails
Hey all, I need to launce a rather lengthy process from a small Rails application. It''s the sort of thing (sending out an email newsletter) that would need to be launched from a browser window, but the browser doesn''t need to stick around to see it through. I played around with Thread.new, but I think, based on limited testing, that the threads need to complete before the view