Dango Dango - 10 months ago 71
Ruby Question

Rails Modify Scaffold Form

Using rails 5.0.0 for building a simple timecard module for a web application. My question is how do I go about modifying a form which is automatically being rendered by rails scaffold

rails g scaffold Timesheet user:string clock:string time:datetime

=== new.html.erb file ===

<%= render 'form', timesheet: @timesheet %>

In the user string want to add <%= current_user.email %> and in clock string want to add a drop-down? What is the best way to do this? Already have database table in place etc...

Illustration below

enter image description here

Thanks in advance!


The form is in an automatically generated partial, located in app/views/timesheets/_form.html.erb.