Skip to content

Instantly share code, notes, and snippets.

@naudo
Created August 13, 2012 00:00
Show Gist options
  • Save naudo/3335568 to your computer and use it in GitHub Desktop.
Save naudo/3335568 to your computer and use it in GitHub Desktop.
Models for this is why your app is slow.
# == Schema Information
#
# Table name: pets
#
# id :integer not null, primary key
# name :string(255)
# user_id :integer
# created_at :datetime not null
# updated_at :datetime not null
#
class Pet < ActiveRecord::Base
attr_accessible :name
belongs_to :user
end
# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# name :string(255)
# address :text
# created_at :datetime not null
# updated_at :datetime not null
#
class User < ActiveRecord::Base
attr_accessible :address, :name
has_many :pets
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment