1

Im totally new to Ruby on rails and im trying to make a simple form.this is my code. but the form is not creating. help me out

<h1>Add Post</h1>
<% form_for :post do |f| %>
    <p>
        <%= f.label :title %><br>
        <%= f.text_field :title %>
    </p>


    <p>
        <%= f.label :body %><br>
        <%= f.text_area :body %>
    </p>


    <p>
        <%= f.submit %>
    </p>
<% end %>
3
  • 2
    Try <%= form_for :post do |f| %> Commented Sep 19, 2017 at 2:59
  • 1
    thank you so much @jvillian Commented Sep 19, 2017 at 3:10
  • Sure thing. I added it as an answer. Please feel free to upvote/accept as you see fit. Commented Sep 19, 2017 at 3:12

1 Answer 1

1

Try <%= form_for :post do |f| %>

When you have <%= ... %>, it creates output.

When you have <% ... %>, it executes the ruby code, but creates no output.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.