similar to: orphan habtm rows

Displaying 20 results from an estimated 20000 matches similar to: "orphan habtm rows"

2006 Jul 26
8
team captain - habtm w/has_one...
the below... class User < ActiveRecord::Base has_and_belongs_to_many :teams class Team < ActiveRecord::Base has_and_belongs_to_many :users has_one :captain, :class_name => ''User'' produces the error... Mysql::Error: Unknown column ''users.team_id'' in ''where clause'': SELECT * FROM users WHERE (users.team_id = 1) LIMIT 1 i
2009 Jan 23
3
Bug regarding ActiveRecord and TimeWithZone
I''ve discovered a strange behavior regarding ActiveRecord and TimeWithZone I''ve seen the error when using SQL Server, I have not yet tried with any other database. Here''s output from the console - "User" is a simple model made with a migration. ----------------------------------------- >> d1 = User.find(:first).created_at => Thu, 21 Jun 2001
2006 Jul 26
3
Polymorphic Association with Single Table Inheritance?
Hello, is it possible to setup a model/table schema like this: Groupable --> Membership <-- Group ^ ^ | | User UserGroup I tried the following but failed: Groupable (table with ''type'' column) has_many :memberships, :as => :groupable has_many :groups, :through => :memberships
2006 Jan 19
2
has_many :through
Has anyone had much experience using the new has_many :though options that are currently in Edge Rails? I''m looking at using it in my project but haven''t found much about it. Kyle
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
2008 Apr 21
1
Urgent ActiveRecord has_many Problem - Please Help
Hi Guys, I''ve been looking everywhere for an answer to this but so far without success. I have three models: 1) employees has_many :memberships has_many :projects, :through => :membership 2) projects has_many :memberships has_many :employees, :through => :membership 3) membership belongs_to :employees belongs_to :projects Membership is used to join employees
2007 Jan 15
3
Wrong total_hits when using conditions in find_by_contents
I don''t know if this is a bug, or wanted behavior, but for me it was a pain in... So here''s the problem + a bugfix. Lets say you have a model "Article" with the following fields: title, visible - and these records [code]title, visible ferret talk, 1 ruby talk, 0 ruby on rails, 1 lets talk about ruby, 1[/code] If I let Article act as a ferret, and do: result =
2007 Aug 01
2
map.resources with habtm
Hi I''m trying to use restful resources with recipes and ingredients I''ve set up the models using scaffold_resource. A recipe can have many ingredients and an ingredient can be in many recipes. I''ve set the relationships up using a through. I now want to display a recipe with a list of ingredients but I''m unsure how to proceed. Should I use nested resources and
2008 Sep 16
3
has_one :through eager-loading problem
I have a problem with the :include option in find for my has_one :through association. I have Users, Profiles and Customers, all connected to each other with a has_one :through => :membership association like this: class Profile < ActiveRecord::Base #could also be user or customer has_one :membership # i saw an acrticle of Ryan about has_one :through, there this would be has_many, is
2006 Aug 07
28
Dr Nic’s Magic Models
Welcome! Welcome! Welcome! Ladies and Gentlemen, today you shall be thrilled and dazzled by wonders of magical mystery. Dr Nic?s Magic Models will now be unveiled to all. Mystery and magic that you will be able to perform at home. Within your ActiveRecord models, never again will you need to write: * validates_presence_of validations * has_many and belongs_to statements * has_many
2007 Apr 29
1
better nested set and :through
Hello all, It''s been a while since i''ve been doing any rails development, so i''m a bit rusty. Having found this: http://opensource.symetrie.com/api/better_nested_set/ it looks really interesting and useful for solving something i''m trying to get working. What i have (essentially) is the following models: class Group < ActiveRecord::Base
2007 Jun 25
7
problem after update 3.0.22 -> 3.0.24
Hello everybody, we were running into trouble after upgrading our samba PDC to a new hardware (and a new debian release). Before the upgrade we used 3.0.22 on a debian sarge machine without problems. Moving the installation to a new machine with debian etch (amd64, samba 3.0.24-6etch4) worked good at the first look. A closer look shows the following problems: - a domain member server (samba
2006 May 16
1
:conditions on has_one realationship
Hi there, I''m currently building a membership application and I want to be able to select, not just all the memberships, but the most current membership from the database on a per user basis. I have linked the tables as shown:- class Membership < ActiveRecord::Base belongs_to :payment belongs_to :person end class Person < ActiveRecord::Base has_many :memberships
2007 Nov 07
6
Rich (or any) GUI Components for Rails
HI, I Find rails great but theres lack of rich components, i mean any components except standard html controls.. I cant build everytime my table with all features, we are crud right ? So any component repository planned ? Maybe rails isnt good solution for my requirements ? I heard that components facility is now depreciated in rails... why ? So far im programming asp.net and im using
2006 Jul 10
4
HABTM vs. using has_many :through
All, I''ve heard recently about has_many :through as a necessary alternative to HABTM (when the join table has it''s own id column, say, in a legacy schema). However, is the prevailing Rails wisdom now that one should use has_many :through in _all_ cases? If so, why? Thanks, Wes -- Posted via http://www.ruby-forum.com/.
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 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
2006 May 17
10
HABTM << producing incorrect insert sql ?
Greetings railsers - I''m trying to add to a collection through HABTM, but the sql insert is trying to insert a PK rather than letting mysql produce the auto_increment''ed PK. ## @medication_dose holds a validated, saved model @medication_dose.medication_frequencies << MedicationFrequency.find (:all) The above bails with, Mysql::Error: #23000Duplicate
2006 Apr 16
6
still learning maintaining data with join tables
Class Role has_and_belongs_to_many :users Class User has_and_belongs_to_many :roles Class RolesUsers has_and_belongs_to_many :roles has_and_belongs_to_many :users According to the logs...I''m good through here @roles_users = RolesUsers.find(:all, :conditions => ["user_id = ?", params[:users_id]] ) the next section of controller code is a problem...
2006 Mar 28
3
Rails 1.1: Is HABTM obsolete?
Does the new has_many :through and belongs_to :through obsolete (well, replace and essentially deprecate) has_and_belongs_to_many? Joe -- Posted via http://www.ruby-forum.com/.