Created
October 10, 2017 18:37
-
-
Save ildarusmanov/675df61dffe0db5f7f56a4b84dd608f9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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