I have a database with a couple of tables. One table called spares has foreign keys in another called equipment. When I create a new record, it is added to the spares table however the list action does not show all the columns in the table. It only shows those columns that are not foreign keys. I am using the default action generated by scaffold for list. Why is that so? Do i need to re-write my own code for the view? Thanks in advance -- Dattatraya ------------------------------------------------- Work fascinates me, I can stare at it for hours...!!
nothing wrong - http://api.rubyonrails.com/classes/ActiveRecord/Base.html#M000748 *content_columns*() Returns an array of column objects where the primary id, all columns ending in "_id" or "_count", and columns used for single table inheritance have been removed. On 3/22/06, Dattatraya Gokhale <dgokhale@gmail.com> wrote:> > I have a database with a couple of tables. One table called spares has > foreign keys in another called equipment. When I create a new record, > it is added to the spares table however the list action does not show > all the columns in the table. It only shows those columns that are not > foreign keys. I am using the default action generated by scaffold for > list. > > Why is that so? Do i need to re-write my own code for the view? > > Thanks in advance > > -- > Dattatraya > > ------------------------------------------------- > Work fascinates me, I can stare at it for hours...!! > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060322/6be8bba7/attachment.html
Oh.. so how do I get to display them? Where can I find a reference to this behaviour so that I dont ask stupid questions before checking in the right places? Thanks Dattatraya On 3/22/06, Emin Hasanov <emin@hasanov.com> wrote:> nothing wrong - > http://api.rubyonrails.com/classes/ActiveRecord/Base.html#M000748 > > content_columns() > > > Returns an array of column objects where the primary id, all columns ending > in "_id" or "_count", and columns used for single table inheritance have > been removed. > > > On 3/22/06, Dattatraya Gokhale <dgokhale@gmail.com> wrote: > > > I have a database with a couple of tables. One table called spares has > foreign keys in another called equipment. When I create a new record, > it is added to the spares table however the list action does not show > all the columns in the table. It only shows those columns that are not > foreign keys. I am using the default action generated by scaffold for > list. > > Why is that so? Do i need to re-write my own code for the view? > > Thanks in advance > > -- > Dattatraya > > ------------------------------------------------- > Work fascinates me, I can stare at it for hours...!! > _______________________________________________ > 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 > > >-- Dattatraya ------------------------------------------------- Work fascinates me, I can stare at it for hours...!!
The api is a great resource for functions. http://api.rubyonrails.com If you''re using edge rails, you can build the latest documentation on your local machine so you''ve got the latest documentation to go with the latest features. Use: rake doc:rails It will put the docs in your /doc folder. If you''re using subversion, you might want to ignore that folder and its contents. To answer your questions, there''s a function in ActiveRecord called columns() that returns the columns including the _id fields. http://api.rubyonrails.com/classes/ActiveRecord/Base.html#M000745 -- Wes On 3/22/06, Dattatraya Gokhale <dgokhale@gmail.com> wrote:> > Oh.. so how do I get to display them? > > Where can I find a reference to this behaviour so that I dont ask > stupid questions before checking in the right places? > > Thanks > > Dattatraya > > On 3/22/06, Emin Hasanov <emin@hasanov.com> wrote: > > nothing wrong - > > http://api.rubyonrails.com/classes/ActiveRecord/Base.html#M000748 > > > > content_columns() > > > > > > Returns an array of column objects where the primary id, all columns > ending > > in "_id" or "_count", and columns used for single table inheritance have > > been removed. > > > > > > On 3/22/06, Dattatraya Gokhale <dgokhale@gmail.com> wrote: > > > > > I have a database with a couple of tables. One table called spares has > > foreign keys in another called equipment. When I create a new record, > > it is added to the spares table however the list action does not show > > all the columns in the table. It only shows those columns that are not > > foreign keys. I am using the default action generated by scaffold for > > list. > > > > Why is that so? Do i need to re-write my own code for the view? > > > > Thanks in advance > > > > -- > > Dattatraya > > > > ------------------------------------------------- > > Work fascinates me, I can stare at it for hours...!! > > _______________________________________________ > > 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 > > > > > > > > > -- > Dattatraya > > ------------------------------------------------- > Work fascinates me, I can stare at it for hours...!! > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- -- Wes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060322/1f8c411f/attachment.html