I got the following mappings
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" auto-import="false">
<subclass name="Module.CRM.Models.CallRecord, Module.CRM" extends="Gate.Calls.CallRecord, Gate.SDK" discriminator-value="call_record_id">
<property name="ContactId" column="contact_id" />
...
Possible Duplicate:
Rails - Cannot dup NilClass when using Single Table Inheritance
Hi guys,
I'm using Rails 2.3.8 and Ruby 1.8.7 under Windows (yes I know I should be using linux... don't have time to do that now =P)
I'm trying to make a simple STI model.
Where I have a class User and 1 subclass (BusinessContact) inheritin...
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 <...
Hello,
I'm using STI in Rails, and I've got a Vehicle object, that has many different types of subclasses, like Car, Truck, etc. It's for a simple app, so STI works fine in this case, but I'm having trouble creating a single form where any type of Vehicle record can be created.
Using the following routing:
resources :vehicles
resource...