Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Rails – Where can I edit the views for my form?

I am new to rails and so I have used the rails generate scaffold method and created CRUD functionality for the "barber" model.

I’ve edited the index.html.erb with bootstrap to my liking with no problem.

This is my new.html.erb file.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

<h1>New Barber</h1>


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

<%= link_to 'Back', barbers_path %>

This is how my barber model looks like.

t.string "first_name"
    t.string "last_name"
    t.integer "age"
    t.string "email"

I have this ugly form being displayed in new.html.erb file, for creating a new barber record but I don’t know how or where I can modify the view for this form ?

>Solution :

I assume that you used command rails generate scaffold documented here. The answer to your question is listed there as app/views/posts/_form.html.erb. Replace "posts" with "barbers" to find the file you are looking for.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading