Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class User < ActiveRecord::Base
- # Include default devise modules. Others available are:
- # :confirmable, :lockable, :timeoutable and :omniauthable
- devise :database_authenticatable, :registerable,
- :recoverable, :rememberable, :trackable, :validatable
- has_many :pools
- has_many :games,
- through: :pools
- end
- class Pool < ActiveRecord::Base
- has_many :users
- has_many :games,
- through: :users
- end
- class Game < ActiveRecord::Base
- belongs_to :user
- belongs_to :pool
- end
- u=User.first
- u.games
- SystemStackError: stack level too deep
- from /Users/ShiftedRec/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/irb/workspace.rb:86
- Maybe IRB bug!
- ActiveRecord::Schema.define(version: 20140408165647) do
- create_table "games", force: true do |t|
- t.integer "pool_id"
- t.integer "user_id"
- t.datetime "created_at"
- t.datetime "updated_at"
- end
- add_index "games", ["pool_id", "user_id"], name: "index_games_on_pool_id_and_user_id", unique: true
- create_table "pools", force: true do |t|
- t.string "name"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.integer "user_id" #vestige of old approach
- end
- create_table "users", force: true do |t|
- t.string "email", default: "", null: false
- t.string "encrypted_password", default: "", null: false
- t.string "reset_password_token"
- t.datetime "reset_password_sent_at"
- t.datetime "remember_created_at"
- t.integer "sign_in_count", default: 0, null: false
- t.datetime "current_sign_in_at"
- t.datetime "last_sign_in_at"
- t.string "current_sign_in_ip"
- t.string "last_sign_in_ip"
- t.datetime "created_at"
- t.datetime "updated_at"
- end
- add_index "users", ["email"], name: "index_users_on_email", unique: true
- add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
- end
- class Pool < ActiveRecord::Base
- has_many :games
- has_many :users,
- through: :games
- end
- class User < ActiveRecord::Base
- # Include default devise modules. Others available are:
- # :confirmable, :lockable, :timeoutable and :omniauthable
- devise :database_authenticatable, :registerable,
- :recoverable, :rememberable, :trackable, :validatable
- has_many :games
- has_many :pools,
- through: :games
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement