<Matt.C.Wagner-SWCg6hSX5lit/hvpvFFPbQ@public.gmane.org>
2005-Dec-29 20:04 UTC
Maintaining DB reflection without scaffolding
Hi, I would like to know if there is a way to maintain database reflection for the ''new'' and ''edit'' views whilst removing scaffolding? I''m trying to create a webapp that will be somewhat maintainable by colleagues (that aren''t necessarily web developers) through simple manipulation of db table fields. For example to add another field to the webapp for tracking another tidbit of information, one would just have to add an additional column in the db. I''ve found that as soon as I remove the scaffolding, or try to override the ''new'' or ''edit'' views, the db reflection goes away. Please excuse me if this is in the docs somewhere already, I wasn''t able to find it before posting here. Thank you! Matt -- Matt C. Wagner Information Security Analyst Network Intrusion Detection Security Operations Center Corporate Information Security Wells Fargo Bank This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take any action based on this message or any information herein. If you received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation.
On 30/12/2005, at 9:04 AM, Matt.C.Wagner-SWCg6hSX5lit/hvpvFFPbQ@public.gmane.org wrote:> I would like to know if there is a way to maintain database reflection > for the ''new'' and ''edit'' views whilst removing scaffolding? > > I''m trying to create a webapp that will be somewhat maintainable by > colleagues (that aren''t necessarily web developers) through simple > manipulation of db table fields. > > For example to add another field to the webapp for tracking another > tidbit of information, one would just have to add an additional column > in the db. > > I''ve found that as soon as I remove the scaffolding, or try to > override > the ''new'' or ''edit'' views, the db reflection goes away. > > Please excuse me if this is in the docs somewhere already, I wasn''t > able > to find it before posting here.Check out what Scaffolding does, it''s something like: Model.columns.each do |c| # print field... end Check the docs at api.rubyonrails.org, they have all the details. -- Phillip Hutchings phillip.hutchings-QrR4M9swfipWk0Htik3J/w@public.gmane.org
<Matt.C.Wagner-SWCg6hSX5lit/hvpvFFPbQ@public.gmane.org>
2005-Dec-29 22:30 UTC
RE: Maintaining DB reflection without scaffolding
rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org wrote:>> I would like to know if there is a way to maintain database >> reflection for the ''new'' and ''edit'' views whilst removing >> scaffolding? > > Check out what Scaffolding does, it''s something like: > > Model.columns.each do |c| > # print field... > endPhillip, I forgot to mention that the db reflection also goes away when the scaffolding is generated to disk. So the only way to have db reflection that I''ve found so far is via "dynamic" scaffolding like the following in the controller: scaffold :foobar I haven''t been able to find anything like your psuedo-code above in the generated scaffolding or the API docs. Where do you say it should reside? Matt -- Matt C. Wagner Information Security Analyst Network Intrusion Detection Security Operations Center Corporate Information Security Wells Fargo Bank This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take any action based on this message or any information herein. If you received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation.
Phillip Hutchings
2005-Dec-31 00:11 UTC
[Rails] Maintaining DB reflection without scaffolding
On 30/12/2005, at 11:30 AM, Matt.C.Wagner@wellsfargo.com wrote:> I forgot to mention that the db reflection also goes away when the > scaffolding is generated to disk. So the only way to have db > reflection > that I''ve found so far is via "dynamic" scaffolding like the following > in the controller: > > scaffold :foobar > > I haven''t been able to find anything like your psuedo-code above in > the > generated scaffolding or the API docs. Where do you say it should > reside?Yes, the forms are statically generated, but the table listing isn''t. Generate scaffolding to disk and look in the table view. The code you want will be something like: <% for column in Model.content_columns %> <p> <b><%= column.human_name %>:</b> <!-- form stuff here --> </p> <% end %> -- Phillip Hutchings phillip.hutchings@sitharus.com