I have one db entry:(/db/migrate)

class CreateHalts < ActiveRecord::Migration
  def self.up
    create_table :halts do |t|
      t.integer :troute_id, :null => false
      t.integer :seq
      t.integer :day
      t.integer :arrival
      t.integer :departure
      t.integer :duration
      t.integer :tnode_id, :null => false
      t.string :mode
      t.boolean :junction
      t.integer :distance
      t.timestamps
    end
    execute "alter table halts add constraint fk_halt_troutes foreign 
key (troute_id) references troutes(id)"
    execute "alter table halts add constraint fk_halt_tnodes foreign key 
(tnode_id) references tnodes(id)"
  end

  def self.down
    drop_table :halts
  end
end

and i have one model (app/models)

# == Schema Information
# Schema version: 20081211325430
#
# Table name: halts
#
#  id         :integer(4)      not null, primary key
#  troute_id  :integer(4)      not null
#  seq        :integer(4)
#  day        :integer(4)
#  arrival    :integer(4)
#  departure  :integer(4)
#  duration   :integer(4)
#  tnode_id   :integer(4)      not null
#  mode       :string(255)
#  junction   :boolean(1)
#  distance   :integer(4)
#  created_at :datetime
#  updated_at :datetime
#

class Halt < ActiveRecord::Base
  belongs_to :troute
  belongs_to :tnode
  validates_presence_of :troute_id, :tnode_id
end

earlier, after populating database,
Halt.get(1) was working.





Brian Candler wrote:
> Free Bird wrote:
>> If i type Halt.get, this is the output:
>>>> Halt.get(1)
>> NoMethodError: undefined method `get' for #<Class:0xb7025de8>
>>   from
>> /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:1833:in
>> `method_missing'
>>   from (irb):3
>>>> 
>> 
>> can you please suggest why this is happeneing?
> 
> Did you mean Halt.find(1) ?
> 
> At ar.rubyonrails.com I don't see any "get" method (either class or 
> instance)

-- 
Posted via http://www.ruby-forum.com/.