Created
March 11, 2014 14:49
-
-
Save rylev/9487342 to your computer and use it in GitHub Desktop.
Strong Parameters Wrapper
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
def TasksController | |
def index | |
Task.where(index_params) | |
end | |
def create | |
Task.create!(create_params) | |
end | |
private | |
def index_params | |
StarkParameters::Validator.new(params).require_one(:list_id, :user_id).params | |
end | |
def create_params | |
StarkParameters::Validator.new(params). | |
require(:assignee_id). | |
require_as(task_content: :title). | |
permit(due_date). | |
permit_as(starred: :important). | |
params | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment