single-table-inheritance Questions
1
When defining a relationship, there is a property on the related model (not a DB column), but I would like to sort by it (in the @OrderBy annotation).
I have a base model that is extended using si...
Industrials asked 21/9, 2015 at 17:32
2
While working on Rails 2.3.18 to Rails 3.2.x migration I am facing name issue in type column
Here is the relation that is defined.
app/models/reservation.rb
class Reservation
end
class Reservat...
Behan asked 3/11, 2014 at 7:33
1
Solved
(See below for link to sample project)
WHAT I HAVE WORKING:
I have many user types which I am handling using Single Table Inheritance in Rails, e.g.:
class User < ActiveRecord::Base
self.inh...
Helvetii asked 22/7, 2015 at 20:47
1
Solved
I have a class extending an existing entity with single table strategy (which I can't change).
I want to use UniqueConstraint for that entity so I tried:
@Entity
@Table(name = "t_document")
public...
Homer asked 2/1, 2015 at 10:49
3
Solved
I have two types of classes:
BaseUser < ActiveRecord::Base
and
User < BaseUser
which acts_as_authentic using Authlogic's authentication system. This inheritance is implemented using ...
Concave asked 16/7, 2010 at 6:28
2
Solved
I have this error while trying to list objects from database with hibernate Criteria decorated with simple Restrictions
Criteria criteria = session.createCriteria(Licence.class);
criteria.add(Rest...
Tantalizing asked 11/7, 2014 at 19:21
2
Solved
I have 3 models using Single Table Inheritance. They are for three different types of items that can be purchased on our website. The items are placed into categories, so the Category model has a p...
Soerabaja asked 29/3, 2014 at 20:52
3
Solved
We use single table inheritance for every table in our application. This allows different instances of the same application stack to work with the same DAOs while their entities might differ slight...
Farant asked 2/1, 2012 at 15:29
3
I'm working on a Rails 3.2 app where I use Devise for authentication. I decided to try single table inheritance for managing user roles, but I quickly ran into a problem. I currently have three Use...
Premedical asked 21/4, 2012 at 20:12
1
Solved
This is my base/parent entity, setup so its children are using their own tables.
/**
* @ORM\Entity
* @ORM\Table(name="layer_object")
* @ORM\InheritanceType("JOINED")
* @ORM\DiscriminatorColum...
Cence asked 3/12, 2013 at 18:58
1
Solved
I want to use Single Table Inheritance using a column other than type. According to the Rails documentation - http://api.rubyonrails.org/classes/ActiveRecord/Base.html, I can do this by modifying A...
Jackal asked 29/11, 2013 at 23:53
4
Solved
I have following kinds of classes for hibernate entity hierarchy. I am trying to have two concrete sub classes Sub1Class and Sub2Class. They are separated by a discriminator column (field) that is ...
Torosian asked 14/7, 2010 at 10:13
4
Solved
I am having a problem getting Devise to work the way I'd like with single table inheritance.
I have two different types of account organised as follows:
class Account < ActiveRecord::Base
dev...
Honeyman asked 16/4, 2011 at 23:36
1
I am working on a Symfony2/Doctrine app which uses class-table-inheritance (http://docs.doctrine-project.org/en/2.0.x/reference/inheritance-mapping.html#class-table-inheritance) to manage Complaint...
Kapok asked 6/12, 2012 at 19:44
2
Solved
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
...
Noncombatant asked 20/10, 2010 at 16:44
2
I have comments and articles, both are votable.
So, basically I've three entities, Article, Comment and Vote.
After some reading on Single Table Inheritance in Doctrine2 reference manual, it seem...
Rarefied asked 28/4, 2011 at 19:28
4
Solved
I have the following classes:
Project
Person
Person > Developer
Person > Manager
In the Project model I have added the following statements:
has_and_belongs_to_many :people
accepts_nested_...
Needlecraft asked 31/3, 2010 at 14:50
1
Solved
Im currently mapping a class hierarchy using the single table inheritance strategy (it is not possible for me to use joined). This hierarchy might look like this:
class Parent(Base):
__tablename_...
Polychrome asked 14/6, 2013 at 15:0
3
Solved
I'd like to be able to create a base controller in my Spring app that, among other things, determines if a user is a registered user or not. This base controller, following the template design patt...
Eucalyptus asked 27/1, 2010 at 5:10
1
Solved
In my system I have STI already defined. Dog inherits from Animal, in the animals table there's a type column with the value "Dog".
Now I want to have SpecialDog inherit from dog, just to modify t...
Darlleen asked 4/4, 2013 at 9:46
2
I am using rails 3.0.9 and devise for authentication. Now I'm trying to use single table inheritance because I need to use polymorphism, so I have two classes: UserType1 and UserType2, which inheri...
Traipse asked 19/6, 2012 at 17:57
4
Solved
I've read some of Bill Karwin's answers about single table inheritance and think this approach would be good for the setup I am considering:
Playlist
--------
id AUTO_INCREMENT
title
TeamPlaylist...
Epigraphy asked 16/7, 2012 at 1:33
5
I have problem with my code
class Post < ActiveRecord::Base
end
class NewsArticle < Post
has_many :comments, :as => :commentable, :dependent => :destroy, :order => 'created_at'
en...
Headwards asked 8/4, 2010 at 21:31
2
I have a model
class Post
include Mongoid::Document
include Mongoid::Timestamps
embeds_one :comment
end
and I have comment class
class Comment
include Mongoid::Document
include Mongoid::T...
Kinkajou asked 11/5, 2011 at 12:2
1
I'm trying to find the 10 most recent comments on photos so I can integrate them into an activity feed on my Rails 3.0.3 application.
I've got a Photo model, which inherits from an Upload model us...
Vaudevillian asked 5/7, 2011 at 12:23
© 2022 - 2024 — McMap. All rights reserved.