similar to: Tables names with model classes in seperate modules

Displaying 20 results from an estimated 2000 matches similar to: "Tables names with model classes in seperate modules"

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
2006 Apr 11
2
AR class names
hello all, quick question: how can I find out if a given string matches the name of an ActiveRecord derived class? thanks in advance alan
2007 Jan 23
11
dynamic tablenames
Hi List! May I tap into your combined common sense ? I have a legacy logging app that needs to be modernized. At the moment, Data is going to be stored in 5 tables, one table is going to contain more than 200 million and 2 others about 60 million rows. Mysql will be used, unless someone sees a major advantage in using something else (at the moment data is stored in a raw positioned file format,
2009 Mar 17
11
Refactoring module
Dear all Please see the following module, In module SX3 SX4 and SX5 have similar class Tasklist, but inherit from different class. I will use the following code to connect to different data sources RemoteSX3Model.establish_connection sx3_hash RemoteSX4Model.establish_connection sx4_hash RemoteSX5Model.establish_connection sx5_hash How can I refactor my code in module to look simpler? Thank you
2006 Jul 26
4
Execute code when an inheritance happens, or disabling STI
I am trying to inherit from a ActiveRecord class defined in a plugin. The problem is that ActiveRecord thinks I am doing an STI and is looking up a table that doesn''t exist. Currently, I have a method in the parent class that looks like this: def self.fix_table_name class_eval do set_table_name(Inflector.tableize(self.to_s)) end end The problem is that this method
2010 Jan 26
6
Subclassing ActiveRecord::Base
First of all, sorry for the crossposting, but I put this into the Ruby Forum first of all, but was pointed to this as a more appropriate location. I''m using ActiveRecord and ActiveSupport in a non-rails environment to connect to multiple databases, and I''ve found the following (single database) to cause me an error. Note that params is my database settings and omitted for
2011 May 29
4
Model load time
Hi, I''m getting a little confused how Rails handles loading models. I''m on development mode, using Rails 3.1.0.rc1 on ruby 1.8.7 My application models are: Curso Legislacao Usuario And I have another model that is loaded from a gem Im trying to build: Cidade My gem is actually a simple engine: require ''active_record'' require
2007 Oct 12
6
abstract_class... what exactly does it do
Hi, Does anyone know much about abstract_class? Does it actually prevent instances of the class from being created? Does it disable certain methods? I already know what it''s for, but I want to know what setting self.abstract_class=true actually does. The reason I ask is that I want to use it for a slightly unorthodox purpose. I want a class who''s only attributes are its
2010 Sep 17
6
Rails base model
I''m very new to Ruby and to Rails. I''m coming from PHP and CakePHP. I would like to create a base model from which all other models will inherit from. I have done this: class AppModel < ActiveRecord::Base end and class Post < AppModel end I''m getting the following error: Table ''blog_development.app_models'' doesn''t exist My
2006 Feb 16
10
Confused over Model attrbutes and @ prefix
I''m confused about how attributes work in models. For example: class Page < ActiveRecord::Base attr_accessor :body def foo id # works @id # won''t work IIRC body # won''t work @body #works end end Why doesn''t everything work the same? Joe -- Posted via http://www.ruby-forum.com/.
2008 Dec 09
7
subclassing vs mixins, which one should be used?
Hey all, I have two models in my rails project that share a lot of traits. They each have the same 4 properties, and now I need to add 2-3 methods to each one that will be the same. In the spirit of DRY I am looking for a solution to write these methods only once. Both of these models already inherit from ActiveRecord . . . and I didn''t know if it was safe to just "whip up" a
2006 Mar 28
12
cached-model broken with Rails 1.1
It looks like cached-model is broken again under rails 1.1. Can anyone confirm? Note that the exception below indicates it''s trying to treat CachedModel as the class name of the model, rather than using the proper class name (which is Entry in this case, and the table called entries). This is a model using Single Table Inheritance and acts_as_tree, and worked just fine under 1.0 and
2008 Aug 12
2
Possible buglet (wart ?) of odfWeave 0.7.6 (with workaround)
Dear List, I have had problems inserting some (not all !) figures via odfWeave (using print(someLatticeFunction)...). The figure was correctly displayed in a R device window but the resulting ODF document displayed the correct space for the figure and an empty frame with a "broken image" icon and a "read error" mention. Exploration of the odf (.odt, in my case) file showed
2007 Sep 29
8
Inheritance problem in model
Hello, I''ve got a problem with the inheritance as soon as I try to use it in a model. I''ve got plenty of items which can share a lot of code, so I created a class "Item", which inherits from ActiveRecord::Base, but because it''s not a "real item" but an interface, I set it abstract (writing abstract_class? method). Then I have all the differents
2007 May 03
2
How to run a cpu intensive ruby script with rails functionality
Hi All, I am new to this list and to rails. So far I am loving the way in which it is easy to put together web pages with a database backend. I would love to use the rails functionality (to do the sql queries) and then process the results using some very cpu intensuve tasks. The results will take far longer than it is viable to use a web browser to view the results. I would like to see the
2009 Mar 14
9
null object pattern
I am trying to create a null object in my application. I would like to assigned a null user object for anonymous/ mot-logged-in user, i.e. if session variable has nil data. In my User model, I have created a subclass like this: class UnassignedUser < User def save false end def update false end def username "Unassigned" end def county_id
2011 Dec 03
1
ActiveRecord Abstract class
Hi, I was trying to create an abstract class and a subclass which inherit that abstract class. However, seems like I cannot instantiate the subclass too. Below is my code: //abstractclass2.rb class Abstractclass2 < ActiveRecord::Base self.abstract_class = true end //subclass.rb class Subclass < Abstractclass2 end When I test drive it in rails console, I got the following error:
2006 Mar 29
38
Poll: Which distro do you use for Rails/Ruby development?
Good afternoon, I''ve two quick questions for the Ruby/Rails community. 1) Do you use Linux for Ruby or Rails development? 2) If you use Linux, which distro do you normally use to develop? Thank you for your input. :-) -- Posted via http://www.ruby-forum.com/.
2020 Oct 16
2
Customized theme for Syslinux.cfg
Thank you Gregory your code worked to remove the border in syslinux! It wasn?t the Alpha (that changes the opacity of the border color), but it was the ?shadowing? that had to be changed, so ?none? in the shadowing column worked(you notice the border come back if you change ?none? to ?std?) reference this link for terms: https://wiki.syslinux.org/wiki/index.php?title=Menu#MENU_COLOR ! I am also
2006 Apr 26
4
Adding a column to a table
This is a real newbie question with what i''m sure will be a simple answer... If i add a column a table (in a development application), how do i update my models to reflect this change? Cheers, Steve