Class: Admin::RobotsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Admin::RobotsController
- Defined in:
- app/controllers/admin/robots_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
rubocop:todo Metrics/AbcSize, Metrics/MethodLength.
- #destroy ⇒ Object
- #edit ⇒ Object
- #find_robot_by_id ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
rubocop:todo Metrics/AbcSize, Metrics/MethodLength
37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'app/controllers/admin/robots_controller.rb', line 37 def create # rubocop:todo Metrics/AbcSize, Metrics/MethodLength @robot = Robot.new(params[:robot]) respond_to do |format| if @robot.save flash[:notice] = 'Robot was successfully created.' format.html { redirect_to admin_robot_path(@robot) } format.xml { render xml: @robot, status: :created, location: @robot } else format.html { render action: 'new' } format.xml { render xml: @robot.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
65 66 67 68 69 70 71 72 73 |
# File 'app/controllers/admin/robots_controller.rb', line 65 def destroy @robot.destroy flash[:notice] = 'Robot removed successfully' respond_to do |format| format.html { redirect_to(admin_robots_url) } format.xml { head :ok } end end |
#edit ⇒ Object
34 35 |
# File 'app/controllers/admin/robots_controller.rb', line 34 def edit end |
#find_robot_by_id ⇒ Object
75 76 77 |
# File 'app/controllers/admin/robots_controller.rb', line 75 def find_robot_by_id @robot = Robot.find(params[:id]) end |
#index ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'app/controllers/admin/robots_controller.rb', line 9 def index @robots = Robot.all respond_to do |format| format.html format.xml { render xml: @robots } end end |
#new ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'app/controllers/admin/robots_controller.rb', line 25 def new @robot = Robot.new respond_to do |format| format.html format.xml { render xml: @robot } end end |
#show ⇒ Object
18 19 20 21 22 23 |
# File 'app/controllers/admin/robots_controller.rb', line 18 def show respond_to do |format| format.html format.xml { render xml: @robot } end end |
#update ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'app/controllers/admin/robots_controller.rb', line 52 def update respond_to do |format| if @robot.update(params[:robot]) flash[:notice] = 'Robot was successfully updated.' format.html { redirect_to admin_robot_path(@robot) } format.xml { head :ok } else format.html { render action: 'edit' } format.xml { render xml: @robot.errors, status: :unprocessable_entity } end end end |