Class: Beyond::PluginsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Beyond::PluginsController
- Defined in:
- app/controllers/beyond/plugins_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/controllers/beyond/plugins_controller.rb', line 9 def create tenant_name = params[:plugin].delete :tenant @plugin = Plugin.new(plugin_params) @plugin.tenant = Tenant.find_by_name(tenant_name) if @plugin.save redirect_to root_url, notice: 'You have successfully uploaded a new plugin!' else errors = @plugin.errors..map { |k, v| k.to_s+' ' + v.join(' and ')+' ' } redirect_to root_url, alert: 'There was an error while trying to create your plugin. ' + errors.join(' ') end end |
#new ⇒ Object
5 6 7 |
# File 'app/controllers/beyond/plugins_controller.rb', line 5 def new @plugin = Plugin.new end |
#start ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'app/controllers/beyond/plugins_controller.rb', line 21 def start begin Plugin.find(params[:id]).start redirect_to root_url, notice: 'Plugin started' rescue redirect_to root_url, alert: 'Error: couldn\'t start plugin' end end |
#stop ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'app/controllers/beyond/plugins_controller.rb', line 30 def stop begin Plugin.find(params[:id]).stop redirect_to root_url, notice: 'Plugin stoped' rescue redirect_to root_url, alert: 'Error: couldn\'t stop plugin' end end |