Class: ParticipatesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/participates_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /participates POST /participates.json



41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'app/controllers/participates_controller.rb', line 41

def create
  @participate = Participate.new(params[:participate])

  respond_to do |format|
    if @participate.save
      flash[:notice] = 'Participate was successfully created.'
      format.html { redirect_to(@participate) }
      format.json { render :json => @participate, :status => :created, :location => @participate }
    else
      format.html { render :action => "new" }
      format.json { render :json => @participate.errors, :status => :unprocessable_entity }
    end
  end
end

#destroyObject

DELETE /participates/1 DELETE /participates/1.json



73
74
75
76
77
78
79
80
# File 'app/controllers/participates_controller.rb', line 73

def destroy
  @participate.destroy

  respond_to do |format|
    format.html { redirect_to(participates_url) }
    format.json { head :ok }
  end
end

#editObject

GET /participates/1/edit



36
37
# File 'app/controllers/participates_controller.rb', line 36

def edit
end

#indexObject

GET /participates GET /participates.json



6
7
8
9
10
11
12
13
# File 'app/controllers/participates_controller.rb', line 6

def index
  @participates = Participate.page(params[:page])

  respond_to do |format|
    format.html # index.html.erb
    format.json { render :json => @participates }
  end
end

#newObject

GET /participates/new GET /participates/new.json



26
27
28
29
30
31
32
33
# File 'app/controllers/participates_controller.rb', line 26

def new
  @participate = Participate.new

  respond_to do |format|
    format.html # new.html.erb
    format.json { render :json => @participate }
  end
end

#showObject

GET /participates/1 GET /participates/1.json



17
18
19
20
21
22
# File 'app/controllers/participates_controller.rb', line 17

def show
  respond_to do |format|
    format.html # show.html.erb
    format.json { render :json => @participate }
  end
end

#updateObject

PUT /participates/1 PUT /participates/1.json



58
59
60
61
62
63
64
65
66
67
68
69
# File 'app/controllers/participates_controller.rb', line 58

def update
  respond_to do |format|
    if @participate.update_attributes(params[:participate])
      flash[:notice] = 'Participate was successfully updated.'
      format.html { redirect_to(@participate) }
      format.json { head :ok }
    else
      format.html { render :action => "edit" }
      format.json { render :json => @participate.errors, :status => :unprocessable_entity }
    end
  end
end