Class | AssignmentsController
In: | app/controllers/assignments_controller.rb
Parent: | ApplicationController

### Methods

create destroy edit index new show update

### Public Instance methods

create()

POST /assignments POST /assignments.xml

[Source]

        # File app/controllers/assignments_controller.rb, line 41
    41:   def create
    42:     @assignment = Assignment.new(params[:assignment])
    43:     respond_to do |format|
    44:       if @assignment.save
    45:         flash[:notice] = 'Assignment was successfully created.'
    46:         format.html { redirect_to(@assignment) }
    47:         format.xml  { render :xml => @assignment, :status => :created, :location => @assignment }
    48:       else
    49:         format.html { render :action => "new" }
    50:         format.xml  { render :xml => @assignment.errors, :status => :unprocessable_entity }
    51:       end
    52:     end
    53:   end

destroy()

DELETE /assignments/1 DELETE /assignments/1.xml

[Source]

        # File app/controllers/assignments_controller.rb, line 75
    75:   def destroy
    76:     @assignment = Assignment.find(params[:id])
    77:     if @assignment.destroy
    78:       respond_to do |format|
    79:         format.html { redirect_to(assignments_url) }
    80:         format.xml  { head :ok }
    81:       end
    82:     else
    83:       respond_to do |format|
    84:         format.html { render :action => 'edit' }
    85:         format.xml  { head :bad_request }
    86:       end
    87:     end
    88:
    89:   end

edit()

GET /assignments/1/edit

[Source]

        # File app/controllers/assignments_controller.rb, line 35
    35:   def edit
    36:     @assignment = Assignment.find(params[:id])
    37:   end

index()

GET /assignments GET /assignments.xml

[Source]

        # File app/controllers/assignments_controller.rb, line 4
     4:   def index
     5:     @assignments = Assignment.all
     6:
     7:     respond_to do |format|
     8:       format.html # index.html.erb
     9:       format.xml  { render :xml => @assignments }
    10:     end
    11:   end

new()

GET /assignments/new GET /assignments/new.xml

[Source]

        # File app/controllers/assignments_controller.rb, line 26
    26:   def new
    27:     @assignment = Assignment.new
    28:     respond_to do |format|
    29:       format.html # new.html.erb
    30:       format.xml  { render :xml => @assignment }
    31:     end
    32:   end

show()

GET /assignments/1 GET /assignments/1.xml

[Source]

        # File app/controllers/assignments_controller.rb, line 15
    15:   def show
    16:     @assignment = Assignment.find(params[:id])
    17:
    18:     respond_to do |format|
    19:       format.html # show.html.erb
    20:       format.xml  { render :xml => @assignment }
    21:     end
    22:   end

update()

PUT /assignments/1 PUT /assignments/1.xml

[Source]

        # File app/controllers/assignments_controller.rb, line 57
    57:   def update
    58:     @assignment = Assignment.find(params[:id])
    59:
    60:     respond_to do |format|
    61:       if @assignment.update_attributes(params[:assignment])
    62:         flash[:notice] = 'Assignment was successfully updated.'
    63:         format.html { redirect_to(@assignment) }
    64:         format.xml  { head :ok }
    65:       else
    66:         format.html { render :action => "edit" }
    67:         format.xml  { render :xml => @assignment.errors, :status => :unprocessable_entity }
    68:       end
    69:     end
    70:   end

[Validate]