Im new at Ruby on Rails language and I really need that someone explain me some 'topics' if possible. I've created an app and I Scaffolded it and it created in the controller lots of code but I have doubts. One of them is:
This app is 'empty' so far. It only has a 'New Book' in the first page.
//books\index.html.erb
||| <%= link_to 'New Book', new_book_path %> |||
new_book_path redirects me to books_controller
def new @book = Book.new
respond_to do |format| //-----> What means this 'format'? format.html # new.html.erb // What really mean two options for 'format'? format.json { render json: @book } // What means render json: @book end # new.html.erb -> has this code inside
New author
/*<%= render 'form' %>
<%= link_to 'Back', authors_path %>*/
Can someone explain me what's hapenning here?
I know that these are really silly questions but I'm not getting it.
Thanks in advance.