Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Product < ActiveRecord::Base
- attr_accessible :name, :category_id
- validates :category, presence: true
- belongs_to :category
- end
- class Category < ActiveRecord::Base
- attr_accessible :name
- has_many :products
- end
- FactoryGirl.define do
- factory :category do
- name "MyString"
- end
- end
- FactoryGirl.define do
- factory :product do |f|
- name "MyString"
- category
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement