Class: Cloudstrg::ConfigsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Cloudstrg::ConfigsController
- Defined in:
- app/controllers/cloudstrg/configs_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /configs POST /configs.json.
-
#destroy ⇒ Object
DELETE /configs/1 DELETE /configs/1.json.
-
#edit ⇒ Object
GET /configs/1/edit.
-
#index ⇒ Object
GET /configs GET /configs.json.
-
#new ⇒ Object
GET /configs/new GET /configs/new.json.
-
#show ⇒ Object
GET /configs/1 GET /configs/1.json.
-
#update ⇒ Object
PUT /configs/1 PUT /configs/1.json.
Instance Method Details
#create ⇒ Object
POST /configs POST /configs.json
56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'app/controllers/cloudstrg/configs_controller.rb', line 56 def create @config = @user.build_cloudstrgconfig(params[:config]) @driver_list = CloudStrg.driver_list respond_to do |format| if @config.save format.html { redirect_to @config, notice: 'Config was successfully created.' } format.json { render json: @config, status: :created, location: @config } else format.html { render action: "new" } format.json { render json: @config.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /configs/1 DELETE /configs/1.json
90 91 92 93 94 95 96 97 98 |
# File 'app/controllers/cloudstrg/configs_controller.rb', line 90 def destroy @config = Config.find(params[:id]) @config.destroy respond_to do |format| format.html { redirect_to configs_url } format.json { head :no_content } end end |
#edit ⇒ Object
GET /configs/1/edit
49 50 51 52 |
# File 'app/controllers/cloudstrg/configs_controller.rb', line 49 def edit @config = Config.find(params[:id]) @driver_list = CloudStrg.driver_list end |
#index ⇒ Object
GET /configs GET /configs.json
10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/cloudstrg/configs_controller.rb', line 10 def index @config = @user.cloudstrgconfig if params.has_key? :redirection_url @redirection_url = params[:redirection_url] end respond_to do |format| format.html # index.html.erb format.json { render json: @config } end end |
#new ⇒ Object
GET /configs/new GET /configs/new.json
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/controllers/cloudstrg/configs_controller.rb', line 35 def new @config = @user.cloudstrgconfig if not @config @config = @user.build_cloudstrgconfig end @driver_list = CloudStrg.driver_list respond_to do |format| format.html # new.html.erb format.json { render json: @config } end end |
#show ⇒ Object
GET /configs/1 GET /configs/1.json
24 25 26 27 28 29 30 31 |
# File 'app/controllers/cloudstrg/configs_controller.rb', line 24 def show @config = Config.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @config } end end |
#update ⇒ Object
PUT /configs/1 PUT /configs/1.json
73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'app/controllers/cloudstrg/configs_controller.rb', line 73 def update @config = Config.find(params[:id]) @driver_list = CloudStrg.driver_list respond_to do |format| if @config.update_attributes(params[:config]) format.html { redirect_to @config, notice: 'Config was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @config.errors, status: :unprocessable_entity } end end end |