OSDN Git Service

t#30169:show, index action create all resource
[pettanr/pettanr.git] / app / controllers / ground_colors_controller.rb
1 class GroundColorsController < ApplicationController
2   layout 'test' if MagicNumber['test_layout']
3   before_filter :authenticate_user!, :only => [:index, :show]
4   before_filter :authenticate_author, :only => [:index, :show]
5
6   # GET /ground_colors
7   # GET /ground_colors.json
8   def index
9     @page = GroundColor.page params[:page]
10     @page_size = GroundColor.page_size params[:page_size]
11     @ground_colors = GroundColor.list(@page, @page_size)
12
13     respond_to do |format|
14       format.html # index.html.erb
15       format.json { render :json => @ground_colors.to_json(GroundColor.list_json_opt) }
16     end
17   end
18   
19   def show
20     @ground_color = GroundColor.show(params[:id], @author)
21     respond_to do |format|
22       format.html # show.html.erb
23       format.json { render json: @ground_color.to_json(GroundColor.show_json_opt) }
24     end
25   end
26 end