rails basic

The RESTful

Consider a basic rails controller where you have a series of actions: index, show, new, create, etc. It’s OK when in the starting period the number of this action is limited, but as the number of actions strat to grow, you may mess up with all those actions and result in a big messy controller. REST(Representational State Transfer) is thus designed for arranging those actions, by setup some rules or styles for the web service.

/events/create/     => POST /events
/events/show/id     => GET  /events/id
/events/update/     => PATCH /events/id
/events/destroy/    => DELETE /events/id

Some questions remain to be answered.

the link_to method in rails. link_to(name = nil, options = nil, html_options = nil, &block). What is the options and html_options? For example
<%= link_to ‘Delete’, @link, method: :destroy, data:{ confirm: ‘Are you sure?’ }, class: “btn btn-default” %>

Also, in what situation should we use the <% -%> instead of just <% %>?

Need to learn more about the rails referer.

Learn how render works

render 'new'
<%= render @post.comments %>
<%= render "comments/form" %>

a good website for bootstrap. here