similar to: set_primary_key issue

Displaying 20 results from an estimated 50000 matches similar to: "set_primary_key issue"

2005 Jul 25
0
sqlsever, scaffold and set_primary_key
I found what was wrong with sqlserver adapter. I can rename "id" to other name and it works. Only scaffold does not work correctly. It ignores my set_primary_key command and is looking for "id" name. -- JZ
2006 Mar 03
0
AR::Base.pluralize_table_names doesnt work with scaffold generator, right?
Hi! The script/generator scaffold for models doesnt respect (source in) this config/environment.rb setup, right? Because I can put in there ActiveRecord::Base.pluralize_table_names = false but when I run a command like ruby script/generate scaffold model Something then it throws an error saying that my database scheme doesnt have a Something. However there is a table called something. If I
2006 Feb 28
0
ActiveRecord: Legacy primary keys
Hi, I''m building a frontend for a legacy schema, with tables like this: CREATE TABLE `types` ( `a_type_cd` varchar(6) NOT NULL default '''', `a_type` varchar(30) NOT NULL default '''', PRIMARY KEY (`a_type_cd`) ); The primary key is specified by the user (not auto-generated), and needs to be updateable. I create the following a base class to
2008 Dec 22
3
how to use set_primary_key?
We are trying to use set_primary_key to cause an existing rails db to use a different primary key. This works find for accessing existing data, but gives an error when we try to add a new record, as it seems to still be accessing the record by the default id field at that point. Are there other changes we need to make to get an alternate primary key working? Thanks, Ken
2006 Nov 04
0
any recommendations for handling a non autoincrement primary key
Hey everyone, I''m working on an application that has a table with a nice natural primary key. Outside of the rails world it would be *the* primary key. I would prefer to use this natural primary key and define associations that use it. I''ve done so but the problem is that my form for entering a record in this table is currently failing. I''ve used
2006 May 12
0
Using primary key that is not named "id"
Hi I am using a legacy database that the primary key is named "ProductID" and its type is SERIAL (or INT NOT NULL auto_increment). set_primary_key "ProductID", is added to the Product class Then I used >ruby script/generate scaffold Product Admin to generate my controllers. When I try to insert a new product in the products table, it gave me this error RuntimeError:
2006 Jun 19
3
Using set_primary_key breaks acts_as_tree with non-integer column
I just switched from using the standard "id" column into using my own primary key and generating my own unique id for each record. But, this breaks acts_as_tree. Because my new primary key is not an integer, it breaks the SQL query as follows: StatementInvalid in PagesController#create --------------------------------------------------------------------------------------
2006 Apr 11
7
Undefined Method
Where can I define the method ''tbluser'' in this error? NoMethodError in Tblregisteredphone#list Showing app/views/tblregisteredphone/list.rhtml where line #23 raised: undefined method `tbluser'' for #<Tblregisteredphone:0x375c778> Extracted source (around line #23): 20: </font> 21: </td> 22: <td> 23: <%= link_to
2006 Jun 14
0
Custom Primary Key, Using Primary Key in Form gives "before_type_cast" error?
Hi guys, I''ve got a problem here which i need help from the pro''s in this mailing list I have a legacy app where the User table has a custom structure where "User_id" (username) is the primary key as well as the username used to log in User.rb (model) class User < ActiveRecord::Base set_table_name "cmf901" set_primary_key "user_id" end
2006 Jan 24
0
making an object id editable?
Hello, I am a newbie trying to integrate a legacy schema into a simple Rails app. The table "sites" has primary key called, "site_key." The table is in use by other programs written in other programming languages so I cannot modify the table. I ran script generate scaffold site and then added: set_primary_key "site_key"
2006 Jun 13
2
Custom Primary Key, Using Primary Key in Form "gives before_type_cast" error?
Hi guys, I''ve got a problem here which i need help from the pro''s in this mailing list I have a legacy app where the User table has a custom structure where "User_id" (username) is the primary key as well as the username used to log in User.rb (model) class User < ActiveRecord::Base set_table_name "cmf901" set_primary_key "user_id" end
2005 Dec 26
16
How to create application with single table with primary key
I''m trying without any succes to create application in which I have one keyed table. The table structure is: CREATE TABLE employees ( pin INTEGER PRIMARY KEY, first_name VARCHAR(30) NOT NULL, last_name VARCHAR(30) NOT NULL ); Whenever I enter new record, I need the the filed pin is also filled by user. Whenever a user edit the table, there should be option to edit or not edit the
2006 Jan 16
0
belongs_to with has_and_belongs_to_many
I''m having a problem with belongs_to and has_and_belongs_to_many. Here''s a brief summary of the models involved: class Member < ActiveRecord::Base set_primary_key ''member_id'' has_and_belongs_to_many :projects, :join_table => ''projects__members'' has_many :projects, :foreign_key => ''created_by'' end class
2007 Aug 29
0
Re: How to model large SqlServer database
Thanks for the response - looks like I am going to have to bite the bullet and get on with it. From a Rails perspective, these databases are a mess, in fact from a SQL Server perspective they are a mess and the company knows it, what they won''t do is use some resource to clean them up. >From some initial testing, the framework seems to be ignoring the set_primary_key setting that I
2006 Oct 14
2
issues with validates_associated not throwing error
Hello all I''m having an issue with ruby on rails, and it not throwing an error where it should. I have a class ''clientpool'' that is: class Clientpool < ActiveRecord::Base set_table_name "clientpool" set_primary_key "id" belongs_to :clients, :foreign_key => "cliname" validates_presence_of :cliname validates_associated :client end
2006 Feb 03
3
My associations are coming out nil.
I''ve got a fairly simple system with a table for my Users that includes a CountryId field which looks up to the CountryId field of my Country table. What I would like to happen is for my Rails application, which contains models for both User and Country, to be able to draw the dropdown list of available countries on the edit page, like it does in all the tutorials. My model classes look
2006 Feb 28
3
[AR] #{id} namespace visibility used in finder_sql
Dears, [Rails 1.0.0] I''m working with a legacy schema, and around my 20+ models i''ve used some AR constructs. They are based on a finder_sql doing some dirty sql and using #{id} from the ''pivot'' model for extracting data in other tables. like : class Division < ActiveRecord::Base set_table_name "legacy_division" set_primary_key
2007 Sep 04
2
Use of uniqueidentifer type for primary key?
I''m working on a legacy SQL db. It is distributed, to they are using the uniqueidentifier type for the primary key. At first, at least, I won''t be updating records, but I''m seeing a lot of negativity about using anything other than incrementing integers for the pk--which are obviously inadequate for this environment. It is enough to use set_primary_key? Do I need
2006 May 18
8
Concatenated key
Hi all, I started playing a couple days ago with Rails and it find it very interesting. But I''m a bit stuck with making it work with a concatenated primary key. I want to use my own names for the DB fields and I''m using SQL Server 2005. My tables look roughly like this: CREATE TABLE USERS ( USR_ID VARCHAR(25) NOT NULL PRIMARY KEY, USR_PASS VARCHAR(25) ) CREATE TABLE
2005 Dec 23
2
Abnormal Pagination Using SQL Server
I''m using RoR 1.0, Windows 2000, and SQL Server 2000. I am connecting to the database using these directions: http://wiki.rubyonrails.com/rails/pages/HowtoConnectToMicrosoftSQLServer. Using the scaffold generator to generate the default files (ruby script/generate scaffold Location) I start up WebBrick and pull up the page. There are 58 records in the table. I am given the first 10