Hi, sorry if it is too easy a question but: I have a table with a foreign key in it. When I apply a scaffold to it, it does not show the foreign column in list, edit etc. How can I make it show the foreign column? Chris -- 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 -~----------~----~----~----~------~----~------~--~---
Chris Finch wrote:> I have a table with a foreign key in it. When I apply a scaffold to it, > it does not show the foreign column in list, edit etc. > How can I make it show the foreign column?Scaffold does not show columns of a table that a foreign key refers to. You will need to add this support in your model (belongs_to, has_one/many), view (list, new, show, delete).rhtml files and link the tables with their foreign key relationships accordingly in your controller. If you want an easy way out, try the plugin scaffolding_extensions or streamlined. Send your model details, and tell us what you intend to do, someone over here can help you. --~--~---------~--~----~------------~-------~--~----~ 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 used scaffolding_extensions. There is a problem: In, for example create, the foreign key is shown as the foreign id. But I want to show the foreign id''s name. How do I change it so that it is the name attribute of the foreign key and not it''s id? Thankyou Chris. -- 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 -~----------~----~----~----~------~----~------~--~---
On 1/25/07, Chris Finch <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hi , > I used scaffolding_extensions. > > There is a problem: > In, for example create, the foreign key is shown as the foreign id. But > I want to show the foreign id''s name. How do I change it so that it is > the name attribute of the foreign key and not it''s id?In the associated model: def scaffold_name name_column end Actually, scaffolding_extensions defaults scaffold_name first to self[:name] and then to id, so in your schema the column you want to use must not be named "name". Just put the name of the column that contains the name you want to see in the select box. Jeremy --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---