spec/fake_app.rb in action_args-1.0.0 vs spec/fake_app.rb in action_args-1.0.1
- old
+ new
@@ -37,9 +37,15 @@
@author = Author.find params[:id]
render text: @author.name
end
end
class BooksController < ApplicationController
+ # optional parameter
+ def index(page = 1)
+ @books = Book.limit(10).offset((page.to_i - 1) * 10)
+ render text: 'index'
+ end
+
def show(id)
@book = Book.find(id)
render text: @book.title
end