Skip to content

Instantly share code, notes, and snippets.

@owenthereal
Created September 27, 2011 04:36
Show Gist options
  • Save owenthereal/1244351 to your computer and use it in GitHub Desktop.
Save owenthereal/1244351 to your computer and use it in GitHub Desktop.
Comparison between the DataMapper gem and the ActiveRecord gem
class Store < ActiveRecord::Base
has_many :products
belongs_to :user
validates_presence_of :name
end
> Store.create(:name => "Amazon")
> Store.where(:name => "Amazon")
class Store
include DataMapper::Resource
property :id, Serial
property :name, String
has n, :products
belongs_to :user
validates_presence_of :name
end
> Store.create(:name => "Apple")
> Store.all(:name => "Apple")
@owenthereal
Copy link
Author

Thanks @dukbb, I have fixed that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment