# File app/controllers/survey/choices_controller.rb, line 53 def create @survey_choice = Survey::Choice.new(params[:survey_choice]) @divid = divid_for(@survey_choice) respond_to do |format| if @survey_choice.save format.html { redirect_to @survey_choice, notice: 'Choice was successfully created.' } format.json { render json: @survey_choice, status: :created, location: @survey_choice } format.js else format.html { render action: "new" } format.json { render json: @survey_choice.errors, status: :unprocessable_entity } end end end
DELETE /survey/choices/1 DELETE /survey/choices/1.json
# File app/controllers/survey/choices_controller.rb, line 87 def destroy @survey_choice = Survey::Choice.find(params[:id]) if @survey_choice.answers.count>0 redirect_to action: :show else @divid = divid_for(@survey_choice) @survey_choice.destroy respond_to do |format| format.html { redirect_to survey_choices_url } format.json { head :no_content } format.js end end end
GET /survey/choices/1/edit
# File app/controllers/survey/choices_controller.rb, line 42 def edit @choice = Survey::Choice.find(params[:id]) respond_to do |format| format.html format.js end end
# File app/controllers/survey/choices_controller.rb, line 6 def index @survey_choices = Survey::Choice.all respond_to do |format| format.html # index.html.erb format.json { render json: @survey_choices } end end
GET /survey/choices/new GET /survey/choices/new.json
# File app/controllers/survey/choices_controller.rb, line 29 def new @question= Survey::Question.find(params[:question_id]) @choice=Survey::Choice.new @choice.question=@question respond_to do |format| format.js format.html # new.html.erb format.json { render json: @survey_choice } end end
GET /survey/choices/1 GET /survey/choices/1.json
# File app/controllers/survey/choices_controller.rb, line 17 def show @survey_choice = Survey::Choice.find(params[:id]) respond_to do |format| format.html {redirect_to @survey_choice.question} format.json { render json: @survey_choice } format.js end end
PUT /survey/choices/1 PUT /survey/choices/1.json
# File app/controllers/survey/choices_controller.rb, line 71 def update @survey_choice = Survey::Choice.find(params[:id]) respond_to do |format| if @survey_choice.update_attributes(params[:survey_choice]) format.html { redirect_to @survey_choice, notice: 'Choice was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @survey_choice.errors, status: :unprocessable_entity } 5 end end end
Generated with the Darkfish Rdoc Generator 2.