Forum: Ruby on Rails RE: Maintaining DB reflection without scaffolding

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
unknown (Guest)
on 2005-12-30 00:31
(Received via mailing list)
removed_email_address@domain.invalid 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...
> end

Phillip,

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 H. (Guest)
on 2005-12-31 02:13
(Received via mailing list)
On 30/12/2005, at 11:30 AM, removed_email_address@domain.invalid wrote:

> 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 H.
removed_email_address@domain.invalid
This topic is locked and can not be replied to.