jordan
jordan

Reputation: 10812

rails update crud views

I'm a bit confused about how to update my views after adding columns to my database. I have an object that I needed to store extra info for and added columns to the database and ran the migration. I thought I'd have to update the views manually, but the new.html.erb has this:

<%= render 'form' %>

<%= link_to 'Back', bids_path %>

I had created this object with rails g scaffold Obj. Is there a way to update the views so that the form includes all the information that i need for CRUD functionality. I know I could drop the table and destroy the scaffold and then generate a new scaffold with the new tables, but that doesn't seem like the right way to do things.

Upvotes: 1

Views: 130

Answers (1)

dostu
dostu

Reputation: 1518

<%= render 'form' %>

Renders the 'form' partial, which can be found in the same folder, named as _form.html.erb. Edit that file to add the new fields.

You can read more about Rails partials and layouts here.

Upvotes: 2

Related Questions