spec/spec_helper.rb in binarylogic-searchlogic-2.1.5 vs spec/spec_helper.rb in binarylogic-searchlogic-2.1.6
- old
+ new
@@ -9,10 +9,11 @@
ActiveRecord::Schema.verbose = false
ActiveRecord::Schema.define(:version => 1) do
create_table :companies do |t|
t.datetime :created_at
t.datetime :updated_at
+ t.integer :users_count, :default => 0
end
create_table :users do |t|
t.datetime :created_at
t.datetime :updated_at
@@ -48,10 +49,10 @@
class Company < ActiveRecord::Base
has_many :users, :dependent => :destroy
end
class User < ActiveRecord::Base
- belongs_to :company
+ belongs_to :company, :counter_cache => true
has_many :orders, :dependent => :destroy
alias_scope :username_has, lambda { |value| username_like(value) }
end
class Order < ActiveRecord::Base