kopf1988
2008-Jan-11 04:24 UTC
Hopefully an easy question - post scaffolding add parameters
Okay, so I''ve got a User class. It has :username and :password. I now decide to be google and store every bit of information I can possibly find about the user. So now I have :street :city :state :zip :email :et cetera. Because I have stepped on my rake, I can''t use it (ie shared host, so no rake). I have already added the fields appropriately to the database. Now, I need to figure out how to add them (preferably simply) to the show.rhtml file created by my scaffolding. I looked for something like @user.to_html, but that didn''t work right off the bat. Is there a simple method of getting all the info into an HTML form easily? I know I could just do a for each attribute type of loop, but is there a pre- defined way? I''m trying to keep this program simple at first, lol. -Ryan --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
kopf1988
2008-Jan-11 04:28 UTC
Re: Hopefully an easy question - post scaffolding add parameters
Also, the only ones that show up in new.rhtml and index.rhtml are the old :username and :password. I''ll need to be able to change them quickly too, if possible enough. And note, I can rake on my dev environment. So if there''s a generator that will automatically detect these in the database, that would be very Ruby Rockstar ish. (inside joke). -Ryan On Jan 10, 10:24 pm, kopf1988 <kopf1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Okay, so I''ve got a User class. It has :username and :password. I now > decide to be google and store every bit of information I can possibly > find about the user. So now I > have :street :city :state :zip :email :et cetera. Because I have > stepped on my rake, I can''t use it (ie shared host, so no rake). I > have already added the fields appropriately to the database. Now, I > need to figure out how to add them (preferably simply) to the > show.rhtml file created by my scaffolding. I looked for something like > @user.to_html, but that didn''t work right off the bat. Is there a > simple method of getting all the info into an HTML form easily? I know > I could just do a for each attribute type of loop, but is there a pre- > defined way? I''m trying to keep this program simple at first, lol. > > -Ryan--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
kopf1988
2008-Jan-11 04:31 UTC
Re: Hopefully an easy question - post scaffolding add parameters
Furthermore, using Rails 1.2.6. ^_^ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ryan Bigg
2008-Jan-11 04:40 UTC
Re: Hopefully an easy question - post scaffolding add parameters
No there is no predefined way. You could use a form builder to make it slightly easier on yourself (this is covered in Rails Recipes, and probably on the web somewhere), but you will have to still type out all the tags. On Jan 11, 2008 3:01 PM, kopf1988 <kopf1988-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Furthermore, using Rails 1.2.6. ^_^ > > >-- Ryan Bigg http://www.frozenplague.net Feel free to add me to MSN and/or GTalk as this email. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
kopf1988
2008-Jan-11 04:44 UTC
Re: Hopefully an easy question - post scaffolding add parameters
Isn''t there a method like scaffold :user That is supposed to do that when put in the controller? (I haven''t gotten it to work yet right, but it did make my index work correctly) -Ryan On Jan 10, 10:40 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> No there is no predefined way. You could use a form builder to make it > slightly easier on yourself (this is covered in Rails Recipes, and probably > on the web somewhere), but you will have to still type out all the tags. > > On Jan 11, 2008 3:01 PM, kopf1988 <kopf1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Furthermore, using Rails 1.2.6. ^_^ > > -- > Ryan Bigghttp://www.frozenplague.net > Feel free to add me to MSN and/or GTalk as this email.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Neon
2008-Jan-11 09:38 UTC
Re: Hopefully an easy question - post scaffolding add parameters
From what I understand of your first post, you now want to be able to see those fields within the form view so that you can start adding data to it. What you''ll have to do is look in the controllers'' view folder. From there look at the partial file ''_form.rhtml'' within there you''ll have to manually add the new fields into that form file. Just copy and paste one of the already listed text_field and update the names to reflect the information you would like to store, making sure it matches the names in your database model of course. <% for column in User.content_columns %> <p> <b><%= column.human_name %>:</b> <%=h @user.send(column.name) %> </p> <% end %> On Jan 10, 8:44 pm, kopf1988 <kopf1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Isn''t there a method like > scaffold :user > > That is supposed to do that when put in the controller? (I haven''t > gotten it to work yet right, but it did make my index work correctly) > > -Ryan > > On Jan 10, 10:40 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > No there is no predefined way. You could use a form builder to make it > > slightly easier on yourself (this is covered in Rails Recipes, and probably > > on the web somewhere), but you will have to still type out all the tags. > > > On Jan 11, 2008 3:01 PM, kopf1988 <kopf1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Furthermore, using Rails 1.2.6. ^_^ > > > -- > > Ryan Bigghttp://www.frozenplague.net > > Feel free to add me to MSN and/or GTalk as this email.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Neon
2008-Jan-11 09:41 UTC
Re: Hopefully an easy question - post scaffolding add parameters
From what I understand of your first post, you now want to be able to see those fields within the form view so that you can start adding data to it. What you''ll have to do is look in the controllers'' view folder. From there look at the partial file ''_form.rhtml'' within there you''ll have to manually add the new fields into that form file. Just copy and paste one of the already listed text_field and update the names to reflect the information you would like to store, making sure it matches the names in your database model of course. On Jan 10, 8:44 pm, kopf1988 <kopf1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Isn''t there a method like > scaffold :user > > That is supposed to do that when put in the controller? (I haven''t > gotten it to work yet right, but it did make my index work correctly) > > -Ryan > > On Jan 10, 10:40 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > No there is no predefined way. You could use a form builder to make it > > slightly easier on yourself (this is covered in Rails Recipes, and probably > > on the web somewhere), but you will have to still type out all the tags. > > > On Jan 11, 2008 3:01 PM, kopf1988 <kopf1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Furthermore, using Rails 1.2.6. ^_^ > > > -- > > Ryan Bigghttp://www.frozenplague.net > > Feel free to add me to MSN and/or GTalk as this email.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Neon
2008-Jan-11 10:22 UTC
Re: Hopefully an easy question - post scaffolding add parameters
You could also just regenerate the scaffold. Any non identical file will be asked to be overwritten, only confirm the _form.rhtml file. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Jeremy Evans
2008-Jan-11 17:00 UTC
Re: Hopefully an easy question - post scaffolding add parame
kopf1988 wrote:> Isn''t there a method like > scaffold :user > > That is supposed to do that when put in the controller? (I haven''t > gotten it to work yet right, but it did make my index work correctly) > > -RyanThat should work in Rails 1.2.6 (though it may bring up a deprecation warning), but not in Rails 2.0. In Rails 2.0, you can add it back using a plugin. You might want to look at the Scaffolding Extensions plugin: http://wiki.rubyonrails.com/rails/pages/Scaffolding+Extensions+Plugin Jeremy -- 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 -~----------~----~----~----~------~----~------~--~---