Class: Barbeque::AppsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Barbeque::AppsController
- Defined in:
- app/controllers/barbeque/apps_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/barbeque/apps_controller.rb', line 18 def create @app = Barbeque::App.new(params.require(:app).permit(:name, :docker_image, :description)) if @app.save redirect_to @app, notice: 'App was successfully created.' else render :new end end |
#destroy ⇒ Object
38 39 40 41 42 |
# File 'app/controllers/barbeque/apps_controller.rb', line 38 def destroy @app = Barbeque::App.find(params[:id]) @app.destroy redirect_to root_path, notice: 'App was successfully destroyed.' end |
#edit ⇒ Object
14 15 16 |
# File 'app/controllers/barbeque/apps_controller.rb', line 14 def edit @app = Barbeque::App.find(params[:id]) end |
#index ⇒ Object
2 3 4 |
# File 'app/controllers/barbeque/apps_controller.rb', line 2 def index @apps = Barbeque::App.all end |
#new ⇒ Object
10 11 12 |
# File 'app/controllers/barbeque/apps_controller.rb', line 10 def new @app = Barbeque::App.new end |
#show ⇒ Object
6 7 8 |
# File 'app/controllers/barbeque/apps_controller.rb', line 6 def show @app = Barbeque::App.find(params[:id]) end |
#update ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/barbeque/apps_controller.rb', line 28 def update @app = Barbeque::App.find(params[:id]) # Name can't be changed after it's created. if @app.update(params.require(:app).permit(:docker_image, :description)) redirect_to @app, notice: 'App was successfully updated.' else render :edit end end |