Displaying 4 results from an estimated 4 matches for "frodolarik".
2006 May 22
3
STI, HABTM & counter_cache
Hello world...
I have an interesting issue that the online docs aren''t helping me with.
In my app I have 4 models
Item < ActiveRecord
Deal < Item
Product < Item
Category < ActiveRecord
Item has_and_belongs_to_many :categories...
On each category record I''d like to maintain a product_count and deal_count
to increase performance. This doesn''t appear
2005 Dec 22
1
How to write unit tests with respect to model callbacks?
Hello,
I am exploring the "Testing" part of Rails, but It seems some things
work differently than I thought it would.
Consider the following model:
class Client < ActiveRecord::Base
has_one :project
def after_create
Project.new(:name => self.name, :is_client => true, :client_id
=> self.id).save
end
def after_update
2006 May 05
1
Adding methods to model based on foreign table rows
Hi all,
I wondered if the following is implemented in ActiveRecord:
I have three tables: "products", "properties" and "product_properties"
the products table holds base information for the product, like
product_id, name etc.
>> Product.column_names
=> ["product_id", "name"]
the properties table holds extra "columns" for the
2006 Jan 09
0
Saving or updating multiple models
Hello all,
I was wondering how one would create multiple models in one controller action.
Consider the following models:
class Worker < ActiveRecord::Base
belongs_to :person
belongs_to :user
validates_presence_of :person_id
end
class Person < ActiveRecord::Base
has_many :workers
end
class Client < ActiveRecord::Base
has_many :workers
end
class User <