summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
9e591d8)
Naming the association in the model makes the relationship easier
to express in the factory.
class UserRole < ActiveRecord::Base
belongs_to :user
class UserRole < ActiveRecord::Base
belongs_to :user
+ belongs_to :granter, :class_name => "User"
ALL_ROLES = %w(administrator moderator).freeze
ALL_ROLES = %w(administrator moderator).freeze
--- /dev/null
+FactoryGirl.define do
+ factory :user_role do
+ user
+ association :granter, :factory => :user
+ end
+end