has-many

counter_cache in single table inheritance

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| ...

Rails 3 single table inheritence w/ has_many question

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 <...

Effective usage of :finder_sql in has_many associations in Rails

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...

Fluent Nhibernate : Unexpected row count: 0; expected: 1

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...