Pracede
Pracede

Reputation: 4371

Ruby on Rails : How to see information in render form?

I am learning Ruby On Rails.I'd like to understand how RoR works. I have the following url when i want to edit user informations:

http://localhost:3000/users/3/edit

Here is my controller :

  # GET /users/1/edit
  def edit
  end

The form is :

<div class="ui middle aligned center aligned grid">
<div class="column">

<h1>Profil</h1>

<div class="ui form segment">

<%= render "form" %>

</div>
</div>
</div>
<%= link_to 'Show', @user %> |
<%= link_to 'Back', users_path %>

I understand that the form is print by the code <%= render "form" %>. I'd like to know how to see what contains form ? Which informations are available in form ?

Upvotes: 0

Views: 1384

Answers (2)

Noman Ur Rehman
Noman Ur Rehman

Reputation: 6957

The render method is used to load a partial. A partial is basically repeated fragment of code in a view. To keep things dry, you separate it out in a partial and then pass it to the render method to render it.

In your case, the form is a partial.

You will most probably find it at app/views/users/_form.html.erb

Partials are always prefixed with a _ in their filename.

Upvotes: 0

Oleh  Sobchuk
Oleh Sobchuk

Reputation: 3722

In your case

<%= render "form" %>

renders partial. You should find file with name _form.html.erb

or read more about partials in GUIDE

Upvotes: 1

Related Questions