Created
November 11, 2016 17:37
-
-
Save bhserna/1011700385b91d3cbd03b626e6fcda8a to your computer and use it in GitHub Desktop.
5 Rules - Call Module functions on Rails components
This file contains 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 Admin::ProjectFundingTerminationsController < Admin::BaseController | |
def new | |
project = find_project | |
form = Projects.terminate_funding_form(project) | |
render locals: { project: project, form: form }, layout: false | |
end | |
def create | |
termination = Projects.terminate_funding( | |
find_project.id, | |
params, | |
projects_store: Project, | |
investment_receipts_creator: DelayedInvestmentReceiptsCreator | |
) | |
if termination.success? | |
render partial: "admin/projects/projects_list", locals: { projects: admin_projects_list } | |
else | |
render status: :unprocessable_entity | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment