Sha256: cee36fcb3d39a0c794416210443508845417fea0e9b37b1d16d36dbf68d8741c
Contents?: true
Size: 711 Bytes
Versions: 1
Compression:
Stored size: 711 Bytes
Contents
class BooksController < ApplicationController def index @books = Book.all end def show @book = Book.find(params[:id]) end def new @book = Book.new.tap { |b| b.build_author } end def create @book = Book.new(params[:book]) if @book.save redirect_to @book, notice: 'Book created!' else render 'new' end end def edit @book = Book.find(params[:id]) end def update @book = Book.find(params[:id]) if @book.update_attributes(params[:book]) redirect_to @book, notice: 'Book updated!' else render 'edit' end end def destroy Book.destroy(params[:id]) redirect_to books_url, notice: 'Book destroyed!' end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bootstrap_form_builder-0.0.1 | test/dummy/app/controllers/books_controller.rb |