Created
November 1, 2011 17:28
-
-
Save levinotik/1331265 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Started POST "/devices.json" for 127.0.0.1 at 2011-11-01 13:49:16 -0400 | |
Processing by DevicesController#create as JSON | |
Parameters: {"{device: { identifier: 12345567891, registration: 234332 } }"=>nil} | |
[1m[36mAREL (0.6ms)[0m [1mINSERT INTO "devices" ("identifier", "registration", "created_at", "updated_at") VALUES (NULL, NULL, '2011-11-01 17:49:16.522201', '2011-11-01 17:49:16.522201')[0m | |
Completed 201 Created in 25ms (Views: 2.8ms | ActiveRecord: 0.6ms) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DevicesController < ApplicationController | |
# GET /devices | |
# GET /devices.xml | |
def index | |
@devices = Device.all | |
respond_to do |format| | |
format.html # index.html.erb | |
format.xml { render :xml => @devices } | |
format.json { render :json => @devices} | |
end | |
end | |
def find_by_identifier | |
@device = Device.find(params[:identifier]) | |
respond_to do |format| | |
format.html # show.html.erb | |
format.xml { render :xml => @device } | |
format.json { render :json => @device} | |
end | |
end | |
# GET /devices/1 | |
# GET /devices/1.xml | |
def show | |
@device = Device.find(params[:id]) | |
respond_to do |format| | |
format.html # show.html.erb | |
format.xml { render :xml => @device } | |
format.json { render :json => @device} | |
end | |
end | |
# GET /devices/new | |
# GET /devices/new.xml | |
def new | |
@device = Device.new | |
respond_to do |format| | |
format.html # new.html.erb | |
format.xml { render :xml => @device } | |
format.json { render :json => @device} | |
end | |
end | |
# GET /devices/1/edit | |
def edit | |
@device = Device.find(params[:id]) | |
end | |
# POST /devices | |
# POST /devices.xml | |
def create | |
@device = Device.new(params[:device]) | |
respond_to do |format| | |
if @device.save | |
format.html { redirect_to(@device, :notice => 'Device was successfully created.') } | |
format.xml { render :xml => @device, :status => :created, :location => @device } | |
format.json { render :json => @device, :status => :created, :location => @device } | |
else | |
format.html { render :action => "new" } | |
format.xml { render :xml => @device.errors, :status => :unprocessable_entity } | |
format.json { render :json => @device.errors, :status => :unprocessable_entity } | |
end | |
end | |
end | |
# PUT /devices/1 | |
# PUT /devices/1.xml | |
def update | |
@device = Device.find(params[:id]) | |
respond_to do |format| | |
if @device.update_attributes(params[:device]) | |
format.html { redirect_to(@device, :notice => 'Device was successfully updated.') } | |
format.xml { head :ok } | |
format.json { head :ok } | |
else | |
format.html { render :action => "edit" } | |
format.xml { render :xml => @device.errors, :status => :unprocessable_entity } | |
format.json { render :json => @device.errors, :status => :unprocessable_entity } | |
end | |
end | |
end | |
# DELETE /devices/1 | |
# DELETE /devices/1.xml | |
def destroy | |
@device = Device.find(params[:id]) | |
@device.destroy | |
respond_to do |format| | |
format.html { redirect_to(devices_url) } | |
format.xml { head :ok } | |
format.json {head :ok} | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActiveRecord::Schema.define(:version => 20111031200340) do | |
create_table "devices", :force => true do |t| | |
t.string "identifier" | |
t.string "registration" | |
t.datetime "created_at" | |
t.datetime "updated_at" | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Started POST "/devices" for 127.0.0.1 at 2011-11-01 13:45:36 -0400 | |
Processing by DevicesController#create as HTML | |
Parameters: {"utf8"=>"✓", "authenticity_token"=>"L1UzbLkj4iuYr+ITdbUg9uwb63jqjFmfF54luh5w1A0=", "device"=>{"identifier"=>"fooo", "registration"=>"baaar"}, "commit"=>"Create Device"} | |
[1m[36mAREL (1.1ms)[0m [1mINSERT INTO "devices" ("identifier", "registration", "created_at", "updated_at") VALUES ('fooo', 'baaar', '2011-11-01 17:45:36.053288', '2011-11-01 17:45:36.053288')[0m | |
Redirected to http://localhost:3000/devices/24 | |
Completed 302 Found in 21ms |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Started GET "/devices/24" for 127.0.0.1 at 2011-11-01 13:45:36 -0400 | |
Processing by DevicesController#show as HTML | |
Parameters: {"id"=>"24"} | |
[1m[35mDevice Load (0.2ms)[0m SELECT "devices".* FROM "devices" WHERE "devices"."id" = 24 LIMIT 1 | |
Rendered devices/show.html.erb within layouts/application (9.9ms) | |
Completed 200 OK in 20ms (Views: 14.6ms | ActiveRecord: 1.3ms) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment