similar to: making an object id editable?

Displaying 20 results from an estimated 10000 matches similar to: "making an object id editable?"

2006 Feb 21
2
ActiveRecord before_ callbacks question
Hi! I need to set the primary key in a model and postgres table to something different than id. View Edit and such works in the scaffolded controller. However if I click in the controller below the list of data onto New then I get an error message like this: Showing app/views/admin/_form.rhtml where line #5 raised: undefined method `nr_before_type_cast'' for
2013 Feb 10
0
Nested attributes doesnt get updated
Hi Am building a nested form and my code works fine with sqlite3 but throws errors when using Oracle during update action. Am getting the following error: ActiveRecord::RecordNotFound in AWRequestsController#update Couldn''t find WADetail with ID=5000000015 for AWRequest with ID=5000000022.0 Request *Parameters*: {"utf8"=>"✓",
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
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 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 Jan 19
1
[Newbie] undefined method `useremail'' error
Hi all, I''m just starting out... the solution to this must be really trivial but can''t figure out what''s wrong. I''m using Webrick + Rails 1.0 The error is: undefined method `useremail'' error What am I missing? Thanks, Lorenzo class User < ActiveRecord::Base set_table_name "\"tblUser\"" set_primary_key
2005 Dec 27
0
Edge Rails idea -- was [DRY relative to edit and show]
Just got around to understanding your idea Rich. Your idea seems to apply to every controller with new/edit/show views, so I think this is a better idea for the edge rails folks to implement generically than for a newbie like me do as a one-off. Thanks Greg On 12/23/05, Rich Clingman <Rich-xT5DcnBKZlNBDgjK7y7TUQ@public.gmane.org> wrote: > > > It would be nice if rails had a
2008 Jan 23
1
Making Parents object attributes available
Hello, I have a class Person class Persoon < ActiveRecord::Base set_table_name "Persoon" set_primary_key "p_persoon" has_many :adres, :class_name => "Adres" composed_of :name, :class_name => Name, :mapping => [ [:naam,:naam], [:voornaam,:voornaam], [:voornaam2,:voornaam2], [:persnickname,:persnickname], [:perssortname,:perssortname] ] def
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 Apr 18
1
''wrong number of arguments'' for text_field?
This is probably something very simple but I can''t seem to figure out why I keep getting the ''wrong number of arguments (1 for 2)'' error with the following code when I try to create a new record. If anyone can see what is going wrong here please help! new.rhtml ------------------------------------------------- ... <%= start_form_tag :action =>
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 Jun 19
3
Parent Child form using Partials
I am trying to make a simple application which consists of contacts and their addresses. class Contact < ActiveRecord::Base has_many :addresses end class Address < ActiveRecord::Base belongs_to :contact end I would like to be able to edit/add addresses from within the edit/add of the contact. I scaffolded the contact and address objects and modified the contacts/_form partial as
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 Apr 17
0
set_primary_key issue
Hi: I am new to the ruby and rails. What I am tried to do is to create a scaffold based on an existing table in a MS SQL Server database. Before I used the set_primary_key method, edit and show does not work in the generated code. Rails displayed the list of the records ok, but can not determine the id for each record. Create a new record does work properly, however. After I used the
2006 Mar 01
1
observe_field question
I''m sure this is a simple problem, but I''ve been working on it for a couple days and can''t seem to figure out the correct way to structure my observe_field call. The HTML and Javascript generated all appear correct, but the AJAX call is never made. Below is the code I''m using and any help would be much appreciated. models_controller.rb def
2006 Jul 27
1
Weird issue with editing data.
Hi all. Ive got a small CRUD app that is giving me some weird isuses. If I add/create an entry that works fine, the data goes into the db. I can later show the data, but when I edit it, no data is displayed in the form for me to edit. Here is the bits from the controller. def new @kb=Knowledgebase.new end def create @kb= Knowledgebase.new(params[:kb]) if @kb.save
2006 Apr 29
1
can i alter the _form.rhtml without have troubles to validat
hello my name is reynaldo and i have a problem i alter the _form.rhtml to display a select option in the place a simple text_box, and the application work very well, but in the moment that i apply a validation in the model i get a error. the code is the next in the controller: def new @catelemento = Catelemento.new @komandancias = Catcomandancia.find(:all) end in the
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 Jan 03
6
Am I going too far or Rails is just confusing? was {validates_presence_of *_id attributes}
Thanks for the input Blair Zajac and Chris (Nolan and Hall), and for others. If all of you have time, please follow this (the question still relates to the previous posts by me): I have provided full steps to reproduce the symptoms. If it matters, I''m running Ruby 1.8.2, Rails 1.0, and MySQL 5.0.15 on Windows XP Professional. 1. First, the setup MySQL ----- create database testdb;
2007 Jan 20
1
Not appear error message
I have a partial form "empresa". In new.rhtml of "empresa", I call the partial form of "usuario". Well, it is happening the following: When save empresa, and stop in validates, as much in "empresa" how much "usuario", appear only error message of "empresa", and not of "usuario". Because this happening? ps1.: I use flash_message