All, When I generate scaffolding on my model, it doesn''t display all the fields in the create and edit views. It populates the views with text/char and date types, but omits any integer fields. Is this normal behavior or a bug? Thanks! -Nick
It''s normal behavior IF the integers you speak of are foreign keys to other tables. If they''re just normal values like "age" then they should display fine... I just did a form a few hours ago and my integers worked. Let''s see your table structure... -----Original Message----- From: rails-bounces@lists.rubyonrails.org [mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of Nick Pavlica Sent: Thursday, January 19, 2006 11:07 AM To: rails@lists.rubyonrails.org Subject: [Rails] A simple scaffolding question All, When I generate scaffolding on my model, it doesn''t display all the fields in the create and edit views. It populates the views with text/char and date types, but omits any integer fields. Is this normal behavior or a bug? Thanks! -Nick _______________________________________________ Rails mailing list Rails@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails
On 1/19/06, Hogan, Brian P. <HOGANBP@uwec.edu> wrote:> It''s normal behavior IF the integers you speak of are foreign keys to > other tables. If they''re just normal values like "age" then they should > display fine... I just did a form a few hours ago and my integers > worked.Here is a look at my table: CREATE TABLE services ( id bigserial NOT NULL, account_id bigint NOT NULL, country character varying(100) NOT NULL, region character varying(100) NOT NULL, area character varying(100) NOT NULL, ); ALTER TABLE ONLY services ADD CONSTRAINT services_pkey PRIMARY KEY (id); The account_id field is not being displayed in this case. I have tried with other schemas with the same results. Also, is it possible to include the record id as well? I''m using ruby 1.8.2 & rails 1.0 Thanks! -Nick> > Let''s see your table structure... > > -----Original Message----- > From: rails-bounces@lists.rubyonrails.org > [mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of Nick Pavlica > Sent: Thursday, January 19, 2006 11:07 AM > To: rails@lists.rubyonrails.org > Subject: [Rails] A simple scaffolding question > > > All, > When I generate scaffolding on my model, it doesn''t display all the > fields in the create and edit views. It populates the views with > text/char and date types, but omits any integer fields. Is this normal > behavior or a bug? > > Thanks! > -Nick > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Account_ID will not show up in scaffolding. That''s not important though.. Scaffolding is not meant for production, it''s meant for you to have a place to start. In fact, as you get better, you''ll rely on it less and less. The record ID is already there. In your "show" action you should have this: @service = Service.find(params[''id''] And on your page, simply doing @service.id gives you the record id. You usually never show that on a page because it''s considered to be a surrogate key... One that means nothing to a user. Based on that assumption, scaffolding will ignore that as well. -----Original Message----- From: rails-bounces@lists.rubyonrails.org [mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of Nick Pavlica Sent: Thursday, January 19, 2006 12:13 PM To: rails@lists.rubyonrails.org Subject: Re: [Rails] A simple scaffolding question On 1/19/06, Hogan, Brian P. <HOGANBP@uwec.edu> wrote:> It''s normal behavior IF the integers you speak of are foreign keys to > other tables. If they''re just normal values like "age" then they > should display fine... I just did a form a few hours ago and my > integers worked.Here is a look at my table: CREATE TABLE services ( id bigserial NOT NULL, account_id bigint NOT NULL, country character varying(100) NOT NULL, region character varying(100) NOT NULL, area character varying(100) NOT NULL, ); ALTER TABLE ONLY services ADD CONSTRAINT services_pkey PRIMARY KEY (id); The account_id field is not being displayed in this case. I have tried with other schemas with the same results. Also, is it possible to include the record id as well? I''m using ruby 1.8.2 & rails 1.0 Thanks! -Nick> > Let''s see your table structure... > > -----Original Message----- > From: rails-bounces@lists.rubyonrails.org > [mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of Nick Pavlica > Sent: Thursday, January 19, 2006 11:07 AM > To: rails@lists.rubyonrails.org > Subject: [Rails] A simple scaffolding question > > > All, > When I generate scaffolding on my model, it doesn''t display all the > fields in the create and edit views. It populates the views with > text/char and date types, but omits any integer fields. Is this > normal behavior or a bug? > > Thanks! > -Nick > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >_______________________________________________ Rails mailing list Rails@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails
On 1/19/06, Hogan, Brian P. <HOGANBP@uwec.edu> wrote:> Account_ID will not show up in scaffolding.Is it because of it''s data type? I would think that by default everything would be available with the exception of the default id primary key.> That''s not important though.. Scaffolding is not meant for production, > it''s meant for you to have a place to start. In fact, as you get better, > you''ll rely on it less and less.That makes sense, it is a little curious that it drops the account_id field in this case. Possibly because it has ''id'' in its name and is filtered automatically as it would the ''id'' PK.> > The record ID is already there. > > In your "show" action you should have this: > > @service = Service.find(params[''id'']This was allready in my the show action in my controller. I added Record ID: <%= @service.id %> to my show view and everything works just fine. Now I''m trying to add the id field to the list view. In my controller the action is: def list @service_pages, @services = paginate :services, :per_page => 10 end When I add <%= @service.id %> to the view it dies. Shouldn''t all of the attributes be available?> And on your page, simply doing @service.id gives you the record id. You > usually never show that on a page because it''s considered to be a > surrogate key... One that means nothing to a user. Based on that > assumption, scaffolding will ignore that as well.I was using it as my record id wich is very important in my case. Because of the Rails conventions, I wounder it it would be better to just at another serial field that isn''t the "id" field. It just seams like a waste of space though.. --Nick> > > > > -----Original Message----- > From: rails-bounces@lists.rubyonrails.org > [mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of Nick Pavlica > Sent: Thursday, January 19, 2006 12:13 PM > To: rails@lists.rubyonrails.org > Subject: Re: [Rails] A simple scaffolding question > > > On 1/19/06, Hogan, Brian P. <HOGANBP@uwec.edu> wrote: > > It''s normal behavior IF the integers you speak of are foreign keys to > > other tables. If they''re just normal values like "age" then they > > should display fine... I just did a form a few hours ago and my > > integers worked. > > Here is a look at my table: > > CREATE TABLE services ( > id bigserial NOT NULL, > account_id bigint NOT NULL, > country character varying(100) NOT NULL, > region character varying(100) NOT NULL, > area character varying(100) NOT NULL, > ); > > ALTER TABLE ONLY services > ADD CONSTRAINT services_pkey PRIMARY KEY (id); > > The account_id field is not being displayed in this case. I have tried > with other schemas with the same results. > > Also, is it possible to include the record id as well? > > I''m using ruby 1.8.2 & rails 1.0 > > > Thanks! > -Nick > > > > > Let''s see your table structure... > > > > -----Original Message----- > > From: rails-bounces@lists.rubyonrails.org > > [mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of Nick Pavlica > > Sent: Thursday, January 19, 2006 11:07 AM > > To: rails@lists.rubyonrails.org > > Subject: [Rails] A simple scaffolding question > > > > > > All, > > When I generate scaffolding on my model, it doesn''t display all the > > fields in the create and edit views. It populates the views with > > text/char and date types, but omits any integer fields. Is this > > normal behavior or a bug? > > > > Thanks! > > -Nick > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >