Follwed a Guide at
http://guides.rubyonrails.org/getting_started.html.Generated
a scafffold as
rails generate scaffold Post name:string title:string content:text
The content of app/view/posts/
index.html.erb file are as under
Listing posts
Name | Title | Content | |||
---|---|---|---|---|---|
<%= post.name %> | <%= post.title %> | <%= post.content %> | <%= link_to 'Show', post %> | <%= link_to 'Edit', edit_post_path(post) %> | <%= link_to 'Destroy', post, :confirm => 'Are you sure?', :method => :delete %> |
<%= link_to ‘New Post’, new_post_path%>
Now look at following line of code,and
please help me to understand it
-
<% @posts.each do |post| %>
is it will execute when at least one post will be created??) -
<%= post.name %> <%= post.title %> <%= post.content %>
(is it will get a values from database?)
Thanks