Displaying 2 results from an estimated 2 matches for "contact_person".
2006 May 15
8
set_table_name and self.table_name
...that will get key value from a sequence table and then
update it and return a value. I''m hoping to put this in the base
ActiveRecord method so I would like to reference the table name with
self.table_name or something...
class Contacts < ActiveRecord::Base
set_table_name "contact_person"
set_primary_key "p_key"
def get_next_id
ActiveRecord::Base.connection.execute("update
#{self.table_name}_seq SET id = id+1")
res = ActiveRecord::Base.connection.select_value("SELECT * FROM
#{self.table_name}_seq");
res[''id...
2010 May 05
2
uninitialized constant when trying to migrate files
...on file:
class CreateURLs < ActiveRecord::Migration
def self.up
create_table :urls do |t|
t.string :label
t.string :url
t.timestamps
end
end
def self.down
drop_table :urls
end
end
this is the model file:
class URL < ActiveRecord::Base
belongs_to :contact_person
end
any help is appreciated. Thanks!!
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gm...