similar to: Extend dynamically a model

Displaying 20 results from an estimated 2000 matches similar to: "Extend dynamically a model"

2006 May 15
8
set_table_name and self.table_name
I have some legacy tables that I used set_table_name on, I''m attempting to write a method that will get key value from a sequence table and then update it and return a value. I''m hoping to put this in the base ActiveRecord method so I would like to reference the table name with self.table_name or something... class Contacts < ActiveRecord::Base set_table_name
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,
2006 Jan 17
15
legacy database and finder_sql nightmare!
This is my first rails app with a legacy database and I''m having a terrible time getting the models set up correctly. I have an order table that has a primary field named order_number. I have a name table with a primary of item_number. These two tables are liked by the item_number and the order_number, but not as you might think. If the order_number is 2500, then each entry in
2006 Mar 09
3
Building a model from a database view
Hi, I''m trying to use rails to build a model from a database view. I get this output C:\dev\v6\project>ruby script/generate scaffold Assignment ... error Before updating scaffolding from new DB schema, try creating a tab le for your model (Assignment) Is this not possible in Rails? It would be *really* helpful for my application. -------------- next part -------------- An
2005 Mar 08
4
change the model''s table name
I need to change the name of the table a model is connected to... like the example in the API... the table is called mice and I want a class called Mouse. class Mouse < ActiveRecord::Base table_name "mice" end I''m doing this cause I want tables in my language (italian) and avoid the nameS thing. just adding it in that way doesn''t work ArgumentError in
2006 Jan 11
2
Table prefix
Hi everybody, is it possible to override standard RoR table nomination/pluralization to include a suffix? I have some tables with usr_ prefix but i would use "real" table name in model naming. For example i have table usr_accesslogs; in normal use i should create a model called UsrAccesslog instead Accesslog. Is it possible to do this?? Thanx Davide
2009 Mar 18
1
set_table_name woes, fragmented domain class
Hi all, I''m running Rails on top of a Mongrel cluster. I have several model classes that are going to have so many records it is not feasible to keep them all in the same table. So I''ve split out the records into many different tables, each with its own suffix which corresponds to the id of the model to which all records in that particular table belong. For example,
2005 Dec 28
3
acts_as_taggable query
Hi , I couldnt find any mailing list for this nice plugin so I hope this is not off topic.I just have a basic question here. I already had created a table and a model for the tags and items and the join table and now want to use this plugin but I just cant seem to figure out how to make it use my table instead of the default. class Tag < ActiveRecord::Base # already exists and has the
2006 May 08
4
Tables names with model classes in seperate modules
I have a module that deals with content pages and categories in my application so create following tables: content_pages content_categories Obviously I need a Page and Category module to map to these tables, but in order to avoid conflicts with other Category classes, i declare my model classes like this: Content::Page Content::Category Now, that''s all fine - except that my models
2005 Dec 22
3
foreign_key setting ignored
I''m having a spot of bother creating a ''has_many'' relationship between two legacy database tables. The relationship is ''company'' table has many linked records in the ''contact'' table. Iv''e used ''generate scaffold'' on these tables and everything is fine. I then decided to define the relationship in the
2006 Dec 19
9
Stubbing ActiveRecord Models gets very difficult with instance methods
I have seen some basic examples of using Mocha and Stubba with ActiveRecord Models; However, the ones I read were somewhat simplistic. That is they stubbed the find class method of the model, or the execute method of the connection object. While stubbing the find method had the desired effect for the author it did not help with a situation I was hacking away on. Which was writing a test case
2006 Apr 18
7
Connecting to multiple databases
Hi Everyone, I am trying to connect to multiple databases and followed along the Recipe in Chad Fowlers ''Rails Recipes'' book (which basically is about establishing the connection in a subclass of ActiveRecord::Base, and inheriting all classes in need of this connection from this class) Chad Fowler says: "You won''t be able to instantiate an External, of course,
2006 Jan 21
2
Specifying which Oracle schema to use with ActiveRecord
We use Oracle in my company. I have access to 2 schemas (or tablespaces?) : 1.SAL 2.SALDATA I use tables from both schemas. How do i tell active record which schema to look in for the table i want??? I''ve just managed to convince the boss to switch from Java to Rails so this would be a arse if i couldnt use both schemas. Any help would be GREATELY appreciated! Thanks, Chris --
2006 Mar 23
11
ActiveRecord: Oracle metadata loading slow on large database
All, While attempting to use ActiveRecord against a large database, approx. 1700 tables and 4 million rows, I discovered an inefficiency in oci_adapter.rb. The problem seems to be the SQL being generated to lazy-load the columns metadata. "def columns(table_name, name = nil)" method generates the following SQL: select column_name, data_type, data_default, nullable,
2007 Mar 21
6
ORACLE DESC "table_name" Failure
I am getting "DESC CYCLEMSTR" failed; does it exist? errors on a table named CYCLEMSTR in Oracle every 3 out of 4 trys to do a simple find(:all) on the table. It is a legacy table that only contains 12 rows of join information. I don''t understand why it works one out of every 4 or 5 times help please. trace: (eval):3:in `describe''
2006 Mar 24
6
Microsoft SQL Server has me stumped
I''m tinkering around with an old legacy table in SQL Server 2000. Ruby 1.8.4, most recent ADO.rb file from RubyForge, Rails 1.0 Here''s the model: class InventoryItem < ActiveRecord::Base set_table_name "[_SMDBA_].[_INVENTOR_]" set_primary_key "sequence" end Everything works fine. I can retrieve records without issue. However, when create a new
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 Jul 03
9
Migrations from Mysql to Oracle. PLS HELP!
Hi all, I''m using Rails/Mysql as development platform. the production server is under Rails/Oracle. Right now, i''m trying to install my application under the production server, the connection to orcale is fine via Rails, but i have a weird problem. example : here is a extract from my db scheme : Table User :_____________ id_user | first_name |
2008 Mar 14
15
Is anyone running Rails 2.x against a MS SQL Server DB?
I am unable to get ActiveRecord session support to work under 2.x against a SQL Server database. I''m starting to wonder if anyone is running 2.x against SQL Server? Is anyone running under the following configuration: Rails 2.x SQL Server 2000 DB (using AR adapter in ODBC mode) AR store for ActionController session store. I''d like to chat with you if you are. Thanks, Wes --
2006 Feb 27
1
Instance methods in runner?
I am having a devil of a time with some runner actions. I can not seem to call any instance methods on found records. Even when I strip is down to the basics: def self.deliver self.find(:all, :conditions => ["#{Message.table_name}.status = ?", ''pending''], :include => [:site, :template]).each {|m| logger.info m.is_recurring? # my method logger.info