How to define schema for an ActiveRecord model?

Posted by Eric Stanton on Stack Overflow See other posts from Stack Overflow or by Eric Stanton
Published on 2012-12-13T05:01:30Z Indexed on 2012/12/13 5:03 UTC
Read the original article Hit count: 193

Filed under:
|

I can find how to define columns only when doing migrations.

However i do not need to migrate my model.

I want to work with it "virtually".

Does AR read columns data only from db?

Any way to define columns like in DataMapper?

class Post
  include DataMapper::Resource

  property :id,        Serial 
  property :title,     String
  property :published, Boolean
end

Now i can play with my model without migrations/connections.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about activerecord