Displaying 5 results from an estimated 5 matches for "m000471".
Did you mean:
1000471
2006 Mar 13
2
relationship woes
...;'pgm_update_fk''
...
and
class PgmVisit < ActiveRecord::Base
belongs_to :pgm_update, :foreign_key =>
''pgm_update_fk'', :dependent => true
...
According to the has_many docs (http://api.rubyonrails.org/classes/
ActiveRecord/Associations/ClassMethods.html#M000471)
collection<<(object, ?) - adds one or more objects to the collection
by setting their foreign keys to the collection?s primary key.
But when I add a new, unsaved PgmVisit to an unsaved PgmUpdate the
PgmVisit still has a nil foreign key and no pgm_update to show for.
Are the docs faili...
2006 Jan 03
4
Set the foreign key constraint column name?
I am applying Rails to an existing schema and not sure how much the
existing developers will let me go in and rename things. So I need to
discover the limits of what I can change with Rails.
I''ve found set_table_name and set_primary_key, which have been very
useful.
If I have a "foo has_one :bar" relationship, but then in the bar table
my column is named "fooid"
2006 Mar 16
1
beginner question on active record relationships
say I have the following:
# user table
# - id
# - username
# - password
class User < ActiveRecord::Base
has_many :items
end
# item table
# - id
# - user_id
# - name
class Item < ActiveRecord::Base
belongs_to :user
end
What is the correct way for creating a new item instance with
relationships in place (assuming the current user is available in the
current_user instance)? Do you
2006 Jan 17
6
An object that initializes multiple objects?
Hi,
Something that I have noticed is that every class that inherits from
ActiveRecord::Base has a database table of its own.
However what if I don''t want a class to have its own table, but to
actually serve as a proxy to initialize other entries?
For instance as an example, let''s have a form with the fields for
"student name", "student id number",
2006 Feb 13
4
activerecord << operator
Hello,
I am new here and actually I am writing my first RoR app.
My question is:
--------
class Topic < ActiveRecord::Base
has_many :messages
end
class Message < ActiveRecord::Base
belongs_to :topic
end
class ForumController < ApplicationController
def post
message = Message.new(params[:message])
@topic = Topic.find(params[:id])
@topic.messages