I am wondering if the counter_cache would work in single table inheritance.
For these models:
class User
has_many :questions
end
class Question
belongs_to :user, :counter_cache => true
end
class SimpleQuestion < Question
end
class ComplexQuestion < Question
end
So will the following counters work?
create_table(:users) do |t|
...
I've been trying to setup a Single Table Inheritance model in Rails 3 in which the parent class also contains a has_many relationship. Unfortunately I can't get it to work. Here are three classes as an example:
class Article < ActiveRecord::Base
has_many :paragraphs, :dependent => :destroy, :autosave => true
end
class Paragraph <...
In ActiveRecord models you can specify custom SQL-request for has_many associations.
For example,
class User < AciveRecord::Base
has_many :events, :finder_sql => 'SELECT something complex'
end
While user.events returns what I need, the number of records returned can be huge, so I need to have a way to pass parameters for LIMIT. Is t...
Hell All,
** Solved as of now Please see Edit 2 and Edit 3 **
I am NHibernate Newbie- a week old but I though working with it will save me time on new project and not otherwise. I have been banging my head trying to get Nhibernate to save Parent - Child Collection to SQL server database.
My Class Map :
public class OrderMap : Clas...