Displaying 20 results from an estimated 29 matches for "inheritance_column".
2008 Apr 03
2
Change the value stored in inheritance_column
I have been struggling for quite sometime with this.
Is there any way to configure the Model to store user defined value in
the inheritance_column instead of the default value (which is
class_name)
The problem I have is like this:
I have a User model and there are different models which inherit from
this like Admin, Premium, Professional, etc.
Each of these inherited models are identified by a field named role_id
in the users table and it c...
2005 Dec 21
0
Overriding inheritance_column
...ation
from an existing database. The database has a "job" table that
contains a "type" column. I''ve successfully overridden the names of
the table and the name of the inheritance column by adding
def self.table_name()
''job''
end
Job.inheritance_column =''ruby_type''
to the job model, but then I''m unable to access the type field using
the same "<td><%= job.type %></td>" construct that works for all the
other fields in the .rhtml file. This always yields a value of "Job".
I have to...
2006 Jun 01
4
What i do if i have a table with a column named "type"?
Hi everybody!
The class ActiveRecord::Base have a atribute named type and if my
table have a column with the same name i get an error if i use
model.finde, model.save and more...
I dont know what i can do to solve this problem!
Someone know?
Thanks
--
_________
Noel R. Morais
2012 Jun 09
3
ActiveRecord::SubclassNotFound: The single-table inheritance mechanism failed to locate the subclass: 'Transactions::DummyDdnlTransaction'. This error is raised because the column 'type' is reserved for storing the class in case of inheritance. Pleas
...nlTransaction''. This error is raised because the
column ''type'' is reserved for storing the class in case of
inheritance. Please rename this column if you didn''t intend it to be
used for storing the inheritance class or overwrite
Transactions::DummyDdnlTransaction.inheritance_column to use another
column for that information.
Have Googled around, tried solutions like self.subclasses and
require_dependency but they didn''t work for me.
I''m on Rails 2.3.14.
cmdjohnson
--
You received this message because you are subscribed to the Google Groups "Ruby on...
2006 Aug 23
2
Re: STI and Joins Broken
I''ve made a inheritance rework some weeks ago that would possible fix
it since it only loads the inheritance support in the class that''ll use
it.
In STI case, it would load only if the class that descends directly
from AR has been inherited and the column specified in the
inheritance_column is available.
People here told me to wait until next release so we can dig into this,
but if you''ve interesting in testing it out send me a message and i''ll
send you the patch.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscr...
2007 Mar 28
4
Disabling ActiveRecord "type" column subclassing
Hi! I have a legacy table that has a column named "type" and need to
remove this automatic subclassing by ActiveRecord. The api pages are
vague about this, and I tried
self.inheritance_column = "xtype"
which seemed to get me half-way. In the validate_on_create method, the
value of self.type was my model Class name.
How would you disable this feature?
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message b...
2007 Nov 07
1
Serialization of ActiveRecord Instances: No Inheritance Column?
Hey,
I have been looking at ActiveRecord''s serialization code, and noticed
that ActiveRecord::XmlSerializer#serializable_attributes purposely
excludes the STI inheritance column per ``options[:except] =
Array(options[:except]) | Array(@record.class.inheritance_column).''''
Is there a particular reason for this? Would anyone be opposed to my
writing a patch to have this attribute be included?
Cheers,
Matt
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby...
2006 Apr 22
6
STI and type tables?
So by default to get STI, I would have something like:
create_table :items do |t|
t.column "type", :string
t.column "title", :string
end
But if I want to store those type values in a separate table, such
that I have ...
create_table :items do |t|
t.column "item_type_id", :string
t.column "title", :string
2013 Apr 24
8
Problem retreiving catalog
...''Host::Managed''. This error is raised because the column ''type'' is reserved
for storing the class in case of inheritance. Please rename this column if
you didn''t intend it to be used for storing the inheritance class or
overwrite Puppet::Rails::Host.inheritance_column to use another column for
that information.
Ruby 1.8.7, I believe apache is using passenger 2.2.11. I tried 3.0.19,
but then I get errors in the apache log about not finding files in the
/usr/share/puppet/rack/puppetmasterd/public, which AFAICT are application
generated.
Everything was work...
2006 Nov 16
1
Strange indexing issues with CachedModel, STI, and AAF
...mation was indexed).
Here''s my setup:
class Record < CachedModel
acts_as_nested_set
acts_as_ferret( :fields => {
:lft { :index => :untokenized_omit_norms },
:name => {},
:desc => {},
:body => {:strore => :yes},
:role => {},
})
def self.inheritance_column
''role''
end
# methods below .....
end
class FirstRecord < Record
end
class SecondRecord < Record
end
class ApplicationController < ActionController::Base
after_filter { CachedModel.cache_reset }
end
Here''s my CachedModel setup:
- config/environment....
2006 Jan 30
9
error when adding a new table to the existing application
Deniz wrote:
> Hi Everybody,
> I am a newbie in this list so please forgive me if this is a lengthy
> message.
> Currently I am working on a project at my work place that includes
> viewing some oracle tables(I do not have control over to rewrite the
> tables) and searching the tables based on a given criteria with Rails.
> Up untill now everything was working great. The
2006 Jul 05
2
Serialized object behaves weird
Hi!
I got a class named EinsatzFilter which I serialized to session. Before
saving to session it works afterwards I keep getting the message:
"undefined method `to_s'' for #<Person:0x38c6ab8>". "Person" is a from
ActiveRecord::Base inherited class.
Code:
class EinsatzFilter
include ApplicationHelper
attr_reader :personen, :monat, :projekte, :kunde
2005 Nov 01
5
Strange error(s) on windows only
...he subclass:
''PageNodeType''. This error is raised because the column ''type'' is
reserved for storing the class in case of inheritance. Please rename
this column if you didn''t intend it to be used for storing the
inheritance class or overwrite NodeType.inheritance_column to use
another column for that information.
- uninitialized constant FolderNode
- The single-table inheritance mechanism failed to locate the subclass:
''FolderNodeType''. This error is raised because the column ''type'' is
reserved for storing the class in case o...
2007 Jul 22
4
single table inheritance problem
Hallo,
I am having a very strange Problem with STI in my application.
setup:
- two tables one called "wikis" on called "categories" with a hbtm
relationship.
- the wikis table is the sti one with a model PageWiki being extended
from Wiki (and the correspondig type column)
Following happens:
- server restart
- get :wikis, :show_pages
- in show_pages the first line says
2006 Mar 26
4
select information from sqlite_master error
...the subclass: ''table''. This error is raised because the column ''type'' is reserved for storing the class in case of inheritance. Please rename this column if you didn''t intend it to be used for storing the inheritance class or overwrite ActiveRecord::Base.inheritance_column to use another column for that information.:
C:/Program Files (x86)/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:897:in `instantiate_without_callbacks''
C:/Program Files (x86)/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/callbacks.rb:...
2006 May 11
0
Handling instantiate_without_callbacks
...the subclass:
''RMC''. This error is raised because the column ''type'' is reserved for
storing the class in case of inheritance. Please rename this column
if you didn''t intend it to be used for storing the inheritance class
or overwrite NmeaSentence.inheritance_column to use another column
for that information. (ActiveRecord::SubclassNotFound)
from /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/
lib/active_record/callbacks.rb:215:in `instantiate''
from /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/
lib/active_record/b...
2006 Mar 15
2
Table with a field name ''type'' problem.
I have a table with a fieldname called ''type'' which does not present
itself on the CRUD screens. However if I rename it to ''some_type'' it
works just fine. Any ideas? Here is my configuration:
Ruby version 1.8.2 (i386-mswin32)
RubyGems version 0.8.10
Rails version 1.0.0
Active Record version 1.13.2
Action Pack version 1.11.2
Action Web Service version 1.0.0
2006 Feb 28
0
ActiveRecord: Legacy primary keys
...lt;<-EOS
def #{pk}_before_type_cast
return read_attribute(self.class.primary_key) if
read_attribute(self.class.primary_key)
return self.id
end
EOS
end
def self.content_columns
@content_columns = columns.reject { |c| c.name =~ /(_id|_count)$/ ||
c.name == inheritance_column }
end
def update
if !@new_id
sql = "UPDATE #{self.class.table_name} " +
"SET #{quoted_comma_pair_list(connection,
attributes_with_quotes(false))} " +
"WHERE #{self.class.primary_key} = #{quote(id)}"
else
sql = "UPDATE #{se...
2005 Feb 02
1
Error when changing from AR 1.0.1 to 1.6
...nul.at/app/models/user.rb:7\r
the user.rb looks as follows:
class User < ActiveRecord::Base
has_many :post_votes, :foreign_key => ''voter_id''
has_many :topic_subscriptions, :dependent => true
has_many :posts
has_many :topic_reads, :dependent => true
def self.inheritance_column() ''role'' end
include ErrorRaising, RForum::Localization, ActiveRecord::Mixins::Touch
attr_accessor :old_password, :new_password, :retyped_password
# methods
[...]
end
maybe you got an idea what i should do - im still pretty new to rails
--
thanks,
Roman...
2006 Jan 06
0
[PATCH] [3402] Allow lock_version column name to be configured.
...fixtures, etc, etc. Tested against Oracle and
PostgreSQL so far. I''d appreciate it if some MySQL folks could try it
out. Hopefully I got the MySQL CREATE TABLE syntax correct.
http://dev.rubyonrails.org/ticket/3402
Assuming this kind of thing is OK, I''d like to make
''inheritance_column'' and ''schema name'' to respond in the same way.