Skip to content

Instantly share code, notes, and snippets.

@ildarusmanov
Created October 10, 2017 18:37
Show Gist options
  • Save ildarusmanov/675df61dffe0db5f7f56a4b84dd608f9 to your computer and use it in GitHub Desktop.
Save ildarusmanov/675df61dffe0db5f7f56a4b84dd608f9 to your computer and use it in GitHub Desktop.
class Account::ApplicationsController < Account::ApplicationController
expose :applications, ->{ current_user.applications }
expose :application, ancestor: :current_user
def create
if application.save
redirect_to account_application_path(application)
else
render :new
end
end
def update
if application.update(application_params)
redirect_to account_application_path(application)
else
render :edit
end
end
def destroy
application.destroy
redirect_to :index
end
private
def application_params
params
.require(:application)
.permit(:url, :status, :platform, :title, :description, :tags)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment