brookr (owner)

Forks

Revisions

gist: 76566 Download_button fork
public
Public Clone URL: git://gist.github.com/76566.git
Text only
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
class SurveysController < ApplicationController
  # GET /surveys
  # GET /surveys.xml
  def index
    @surveys = Survey.find(:all, :limit => 50)
 
    respond_to do |format|
      format.html # index.html.erb
      format.xml { render :xml => @surveys }
    end
  end
 
  # GET /surveys/1
  # GET /surveys/1.xml
  def show
    @survey = Survey.find(params[:id])
 
    respond_to do |format|
      format.html # show.html.erb
      format.xml { render :xml => @survey }
    end
  end
 
  # GET /surveys/new
  # GET /surveys/new.xml
  def new
    @survey = Survey.new
 
    respond_to do |format|
      format.html # new.html.erb
      format.xml { render :xml => @survey }
    end
  end
 
  # GET /surveys/1/edit
  def edit
    @survey = Survey.find(params[:id])
  end
 
  # POST /surveys
  # POST /surveys.xml
  def create
    @survey = Survey.new(params[:survey])
 
    respond_to do |format|
      if @survey.save
        flash[:notice] = 'Survey was successfully created.'
        format.html { redirect_to(@survey) }
        format.xml { render :xml => @survey, :status => :created, :location => @survey }
      else
        format.html { render :action => "new" }
        format.xml { render :xml => @survey.errors, :status => :unprocessable_entity }
      end
    end
  end
 
  # PUT /surveys/1
  # PUT /surveys/1.xml
  def update
    @survey = Survey.find(params[:id])
 
    respond_to do |format|
      if @survey.update_attributes(params[:survey])
        flash[:notice] = 'Survey was successfully updated.'
        format.html { redirect_to(@survey) }
        format.xml { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml { render :xml => @survey.errors, :status => :unprocessable_entity }
      end
    end
  end
 
  # DELETE /surveys/1
  # DELETE /surveys/1.xml
  def destroy
    @survey = Survey.find(params[:id])
    @survey.destroy
 
    respond_to do |format|
      format.html { redirect_to(surveys_url) }
      format.xml { head :ok }
    end
  end
  
  # GET /surveys/check/1
  def check
    @survey = Survey.find(params[:id])
    @staff = @survey.staff
  end
  
  
end