I have model:
class CreateStores < ActiveRecord::Migration
def change
create_table :stores do |t|
t.integer :admin_id
t.string :name
t.string :subdomain
t.string :linked_domain
t.timestamps
end
end
end
and test:
require 'test_helper'
class Api::Be::UsersControllerTest < ActionController::TestCase
setup do
@admin = FactoryGirl.create :admin
@store = FactoryGirl.create :store
@store.ug_default = UgDefault.new
@store.save
Rails::logger.debug "HERE: #{@store.id}"
@customer = FactoryGirl.create :customer
@customer.userable_id = @store.id
@customer.save
end
In logs I see that @store.id equals nil. What's the problem?
It's probably not getting saved. With your logger, output if there are any errors on the model:
Look for messages at the end of the output.