similar to: Using Ruby on Rails with existing database

Displaying 20 results from an estimated 7000 matches similar to: "Using Ruby on Rails with existing database"

2006 Apr 21
2
me.defeated!
Good afternoon (as appropriate ; ) I''m having a problem and thought I''d run it past these forums to see if there even was a reasonable solution to it. I''m trying to set up a rails application to pull data from a legacy database. The trick is, that the database really wasn''t created with RoR convention over configuration in mind. The trick is that every
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
2006 Jul 18
2
Scaffold a Plural table w/ No Pluralization in environment
Hi guys, I have a situation here. I have my project set to no pluralization due to legacy tables in environment.rb. Now, I have some new tables which I''m starting to pluralize. When I do a generate a scaffold to this new table: script/generate scaffold my_tables table it seems to work out fine for certain sections like http://mysite.com/railsapp/new (which also inserts properly to
2006 Mar 09
8
Problem with scaffolding and table name
Hello, i''m new in ruby rails framework. I have the following problem. I try to create a scaffold for a certain model of my db, but since ruby rails doesn''t assume the table name corectly (its incidents_reported ) i get errors .... Besides renaming the table :) is there a way to ''tell'' ruby rails the name of the table? I haven''t been able to find any
2006 Apr 07
6
Foreign Key naming convention override
I am working with an existing database and have to keep all table and field names as they are. ''tblcustomers'' and ''tblitems'' are linked by the ''tblcustomers'' id field ''tblcustomersid''. In ''tblitems'', the foreign key is called ''txtcustomerid''. I have already set the customers model to
2006 Mar 27
5
Fake ActiveRecord model?
Hi all, I have a legacy table which I cannot get to work with ActiveRecord (no ids etc). All I want is to create a class which opens a connection manually and allows me to execute some plain SQL statements. What I can''t figure out is how to either build up a connection and execute queries from a non-AR inherited class, or how to create a AR-inherited class minus all the AR magic and
2006 Jan 20
4
Prepending table names on a per user or sub domain basis
Here is a sample of the database structure I want to have: someclientname-websites someclientname-canned_responses someclientname-canned_responses_websites anotherclientname-websites anotherclientname-canned_responses anotherclientname-canned_responses_websites As you can see I want to prepend the name of my future clients to the table name so that they use completely different sets of data. I
2006 Apr 13
4
Rails with existing RDBMS schema
Hi, I''m seriously considering using Rails to develop several internal corporate web apps that will need to interact with well-established database systems (3 systems running SQL Server, Oracle, and PostgreSQL). The schema on these systems are basically set in stone. Can a Rails application interact with an existing schema without serious Rails modification? From what I''ve
2010 Aug 19
1
Composite primary keys and :joins=>
I have a legacy db with the following simplified structure: Table-A: type_key, code_key, name, ... # PKs are type_key and code_key, there is no id col and I cannot alter this db Table-B: # each row has only the code as a foreign_key, the type_key is hard-coded to "FOOKEY" an_id, code, ... Models: class TableB < AR::Base set_table_name ''table_b''
2006 Apr 02
2
rails db indexing and through association
Hello, Say, I have a pictures table, and there are many objects which can have pictures, so I define a picturable type. Now, to make the query for pictures more efficient I should index the picture table using both picturable_type and picturable_id. Is this the correct approach to indexing the table, or can things be done better? I want the database retrieval operation to be extremely fast (I
2005 Aug 08
68
Pluralized Controller Names?
If I do: script/generate controller Photo I get a controller named photo_controller. OTOH, if I do: script/generate scaffold Photo I get a controller named photos_controller. (Note that the controller name is pluralized). I realize that I''m specifying the controller name explicitly in the first case, but it seems odd to me that the scaffold command generates a pluralized
2007 Jan 23
7
ActiveRecord requires sequence numbers in Oracle join table
I am mapping ActiveRecord classes to an existing Oracle database. This means I cannot change the database schema to fit ActiveRecord conventions. Predictably, I have gotten into trouble: I have several join tables that do not have a primary key column, and therefore no number sequence defined. ActiveRecord insists on requiring a sequence, and gets unhappy when there is none to find. Is there a
2006 Jul 22
3
Extend dynamically a model
Hello, I''ve a model defined as class Account < ActiveRecord::Base end This maps a mysql table Accounts. I want to be a able to dynamically change this model. During the life of my app, the table Accounts may change name, how do I do a set_table_name not within account.rb? -- Posted via http://www.ruby-forum.com/.
2006 Mar 25
4
dynamic set_table_name for achives
How can I pass something to set_table_name so that I can switch tables on the fly for accessing archive data? If I could access sessions inside a model I would do something like: if @session[:current_period] set_table_name "statistics_" + @session[:archive_year] else set_table_name "statistics_" + Date.now.year end But since I cannot access the session from within a
2007 Jan 14
2
rspec and set_table_name?
Hi there I have a Value class in my Rails app; however ''values'' is a reserved word in MySQL so in my value.rb file, I''ve declared set_table_name as ''vals''. However, in setting up my specs for this model, I''m hitting errors that seem to be resulting from rspec not seeing the set_table_name declaration in my model file. For instance,
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 Apr 13
3
Rails, Views, and Legacy Data
I''d like to better understand the criticisms I''ve seen of Rails'' ability to handle legacy data. The ones I''m interested in are those based on Rails'' naming conventions for tables. In my experience in large corporate environments programmers / programs don''t access db tables directly. They access views of those tables. And, to my
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,
2006 Jan 19
4
multiple database in the same actions?
Hi, I read the example in http://wiki.rubyonrails.com/rails/pages/HowtoUseMultipleDatabases, it show us how to connect to other database, each time we start a new action, however, this doesn''t work while you try to connect to two different database within the same action. SO I wonder is it possible to bind to two or more database within the same action???? Thanks you very much Saiho
2006 Dec 21
3
Speccing private class methods
Hi How can I specify that a private method of a class gets called? If you run the code below, only spec (1) passes. Spec (2) is what I found causing problems in my code, and class (3) is my failed attempt to work around it. (3 really puzzles me - why is a private class method not accessible via send?) Another problem is that stub! makes public methods, which changes the behaviour of