cap008-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Nov-30 18:25 UTC
scaffold leaving out column names ending in _id?
I''ve been trying to get scaffold to display all fields in a simple table. I noticed that if a column name ends in ''_id'' the scaffold ignores it, also the scaffold does not display the primary key, named ''id''. Where can I find a list of the rules that the scaffold follows? If they are simply the rails rules, please provide that link. Thanks! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi, I think the scaffold uses (or at least used to use) this function to create the list of fields: http://api.rubyonrails.org/classes/ActiveRecord/Base.html#M001033 Allan On Nov 30, 6:25 pm, "cap...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <cap...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''ve been trying to get scaffold to display all fields in a simple > table. > I noticed that if a column name ends in ''_id'' the scaffold ignores it, > also the scaffold does not display the primary key, named ''id''. > Where can I find a list of the rules that the scaffold follows? > If they are simply the rails rules, please provide that link. > > Thanks!--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Allan wrote:> Hi, > > I think the scaffold uses (or at least used to use) this function to > create the list of fields: > > http://api.rubyonrails.org/classes/ActiveRecord/Base.html#M001033 > > Allanin your database design, under ROR, the foreign key is <tablename>_id, and is ignored in scaffolding .... but you can add it by hand. easy to do. if i got this wrong, fred made me do it. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
It''s pretty pointless for scaffolding to include these anyway. You''re going to have the id in the URL (for edit pages), you''re going to need to build a picklist for your _id fields because Rails, when you scaffold, can''t know what you''re trying to do. Scaffolding is a learning tool. It was not, and never will be, intended for actual use in a production application. Other projects, like ActiveScaffold and Streamlined, do offer very robust automatic interface builders. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---