Modifying script generated scaffold output Books/Authors

People,

For my little book library db I find the rails script generated stuff
fine for most of my needs but there is one thing I couldn’t figure
out . .

Part of the auto output of app/view/books/edit.rhtml is:

<%= start_form_tag :action => ‘update’, :id => @book %>
<%= render :partial => ‘form’ %>
<%= submit_tag ‘Edit’ %>
<%= end_form_tag %>

but I need to add in:

Author <% @authors.each do |author| %> > <%= author.last_name %> <%= author.first_name %> <%= author.other_name %> <% end %>

so I can update the author (in the author’s table) if necessary. If I
insert this code after the first line above it seems to update the
author OK (comment: shouldn’t the button say “Update”?) but is there
some way to position the author label and field on the page
automatically like the other bookk fields?

Thanks,

Phil.

Philip R.

Pricom Pty Limited (ACN 003 252 275 ABN 91 003 252 275)
GPO Box 3411
Sydney NSW 2001
Australia
Mobile: +61:(0)411-185-652
Fax: +61:(0)2-8221-9599
E-mail: [email protected]

Author

[…snip…]

this should go into the _form.rthml file wich defines the actual
fields displayed

Also I found, that I always rewrite _form.rhtml an “hard-code” field
names etc in order to get the layout I want for my forms.

cu jc

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs