similar to: Self-referential join creation/deletion and :through

Displaying 20 results from an estimated 130 matches similar to: "Self-referential join creation/deletion and :through"

2006 Apr 09
1
Join using :THROUGH - SQL is wrong even when using :SOURCE
Here''s a join table for an educational institution: create_table "student_appointments", :force => true do |t| t.column "supervisor_id", :integer, :default => 0, :null => false t.column "student_id", :integer, :default => 0, :null => false t.column "course_id", :integer, :default => 0, :null => false [other columns
2006 Apr 20
4
Question about Associations
Hi all. Got a stupid-simple question about associations. I have two models - school and course. There are a fixed number of schools (set up in the migration). Each course is assigned a school and a school will be associated with multiple courses... How do I set up the associations? Do (can) I have School :has_one :course and Course :has_many :schools? Does the schools table then get a course_id
2013 Apr 02
4
gmaps4rails: undefined method `model_name' for NilClass:Class
Hi All, just in a spot of bother with this gem, I am trying to create a new location and get the above msg. here is my controller: class LocationsController < ApplicationController # GET /locations # GET /locations.json def index @locations = Location.all @json = Location.all.to_gmaps4rails end respond_to do |format| format.html # index.html.erb
2011 Aug 19
0
find_by_sql Method
Hello guys! I am new in rails. I am querying the courses table for specific courses that belong to specific institute using this sql statement. I''m getting the same courses for all the institutes that I have. Any help on what to put in place of 1 or how to restructure my query will be highly appreciated. Here is my query! <%= select ("course_code",
2006 May 10
2
HABTM - How do I do a select box for this?
I''ve got several habtm''s working fine in my app but have been having trouble with a new twist: imagine an app that tracks students and courses that they''re taking. So there''s a student Class and a course Class, and the tables also, and a students_courses table. This stuff I have down cold. The problem was I wanted a form that allowed associating a student
2008 Aug 31
6
why's my course_duration being reset
Can''t get this?...I''m close I think, my calculation appears to be working, but.... when i access duration = <%= @enquiry.course_duration %><br> in my final view it''s blank.. course_duration is getting set to null but works for the calculation? controller.. ---------- class EnquiriesController < ApplicationController layout ''welcome''
2005 Apr 20
2
Has And Belongs To Many Validations
Here is the schema that I am working with: courses -> courses_teachers <- teachers I want to ensure that a teacher is not assigned the same course more than once. In other words, if I''m in the courses_teachers table as teaching Spanish 101, if someone tries to add that same teacher/course combination to the table again, it will not be allowed. I thought I could use something
2006 Jan 22
2
Relationship not working
Hi all I''m in the process of trying to make my first project on Rails after doing the tutorial in AWDR. I picked a project which I thought would be easy as I already have the PHP/MySQL implementation. Unfortunately I''ve now hit a snag and was wondering if you could help? I have a table called "races" and a table called "courses". The relationship is:
2006 Jul 20
1
self referential xml using builder
Hi listers, I''m trying to build an xml doc using Builder, but I''m having trouble getting it to draw a tree structure from a self-referential table. Here''s what I''m after: ========================== ---- object structure ---- node (name => root) - node (name => child 1) - node (name => child 2) - node (name => child 2.1) - node
2006 May 02
0
Self-referential MtoM implementation
ok, guys i have followed the self referential recipe from the book it works perfect but now i have some doubts, at the end the model are modified to force the user beign added as a friend that add too who are adding him so how i can make that the full relationship doesn?t be complete until the friend beign added approves it(talking in the implementation of the code of course)? by the way,
2006 Apr 17
0
Pros/cons of doubling up in Self-Referential has_many via :through
Relative newbie so would welcome comments re structure of a self-referential relationship I''ve got. It''s started off similar to the Person HABTM friends in the Rails recipes books (working fine), but I needed to turn the join table into a full-blown model as I wanted to add attributes to it. Few tricky bits dealing with the new :through structure and understanding how :scope
2010 Feb 16
0
as_json and self-referential associations
Hi, I''m using the new(?) as_json methods within a rest api I am working on. However I am not sure how you are supposed to, or whether it is designed to handle multiple variations of association inclusion. For example I have a model using acts_as_tree, so that each instance has children and a parent: class CatalogueCategory < ActiveRecord::Base acts_as_tree JSON_ATTRS =
2008 Jan 23
1
Self-referential HABTM SQL mal-formed when updating record
Guys, Anyone ever had this kind of problem with ActiveScaffold? Cheers, Sazima ------------------------------------------------------------------------------------------------ What steps will reproduce the problem? 1. Create self-referential HABTM application (like the common "user has friends" example) 2. Try to add more than 1 friend to a given user using ActiveScaffold. What is
2012 Oct 22
0
[LLVMdev] Self-referential instruction from jump threading
Hi Hal, > After investigating PR14133, I've discovered that jump threading can output self-referential instructions: > %inc.us = add nsw i32 %inc.us, 1 such instructions are valid in unreachable basic blocks. > At least in the test case for that bug report, the relevant code is later deleted (perhaps it is unreachable), and so this does not cause a problem. Unfortunately, when
2012 Oct 22
0
[LLVMdev] Self-referential instruction from jump threading
Hal Finkel wrote: > Hello, > > After investigating PR14133, I've discovered that jump threading can output self-referential instructions: > %inc.us = add nsw i32 %inc.us, 1 > > At least in the test case for that bug report, the relevant code is later deleted (perhaps it is unreachable), and so this does not cause a problem. Unfortunately, when vectorization is enabled, this
2007 Jan 05
1
(Enhancement?) for self referential has_many :through, w/ scoped create...
We have a User model and a Connection model which basically represents edges in a digraph (User to User, self-referenctial). Each of these edges can have a :connection_type which is currently just a char(1). has_many :friendships, :class_name => ''Connection'', :foreign_key => "source_user_id", :conditions =>
2008 Sep 26
0
self-referential tags, has_many_polymorphs
Hi, I''m looking to add tagging to an application, and I would like to allow self-referential tags, so that I can tag my tags. With the goal of generating a flexible tag hierarchy. After some googling it looks like acts_as_taggable is not the best piece of code, and I''m hoping to use the has_many_polymorphs plugin from http://github.com/fauna/has_many_polymorphs/tree/master.
2007 Jul 26
1
Bi-directional self-referential HABTM
Hi, I''m having a little trouble figuring out how to make a self- referential HABTM bi-directional. I have a Employee class. Each employee can have a couple of bosses, who are also employees. The employee class has the following HABTM: has_and_belongs_to_many :bosses, :class_name => "Employee", :join_table => "bosses_courses", :association_foreign_key =>
2006 Mar 25
0
Self-Referential Many-To-Many relationships where the relationship itself has data.
Trying to model a bunch of users that have friends that are other users. clearly a job for has_and_belongs_to_many, but the trick is, they have ratings for their friends. I have gone through the Rails Recipes book, and it seems like I''m trying to combine the self-referential many-to-many recipe (12) and the many to many relationships where the relationship itself has data recipe (16). So
2006 May 29
2
foreign keys and referential integrity
Sans rails my normal approach to handling this would be to enforce it in the database and when a database operation failed I''d try to validate the model to produce an error message. It''s always served me pretty well. Rails expects you to validate before commiting but of course this does nothing to guarantee referential integrity. It''s perfectly possible for one