Skip to content

Instantly share code, notes, and snippets.

@blueplanet
Last active March 6, 2017 08:11
Show Gist options
  • Save blueplanet/5737194 to your computer and use it in GitHub Desktop.
Save blueplanet/5737194 to your computer and use it in GitHub Desktop.
class Event < ActiveRecord::Base
has_many :groups
end
FactoryGirl.define do
factory :seq_group, class: Group do
sequence(:name) { |n| "group #{n}"}
sequence(:description) {|n| "description #{n}"}
sequence(:img_url) {|n| "http://test.com/#{n}.jpg"}
end
factory :group_event, class: Group , parent: :seq_group do
events {
[FactoryGirl.create(:seq_event)]
}
end
end
class Group < ActiveRecord::Base
has_many :events
has_many :members
end
FactoryGirl.define do
factory :group_event, class: Group do
members {
FactoryGirl.create_list(:seq_user, 10)
}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment