Skip to content

Instantly share code, notes, and snippets.

@myobie
Forked from rylev/stark_params.rb
Last active August 29, 2015 13:57
Show Gist options
  • Save myobie/9487365 to your computer and use it in GitHub Desktop.
Save myobie/9487365 to your computer and use it in GitHub Desktop.
class TasksController
def index
Task.where(IndexParams.new(params).params)
end
def create
Task.create!(CreateParams.new(params).params)
end
private
class IndexParams
include StarkParameters
require one: [:list_id, :user_id]
end
class CreateParams
include StarkParameters
require :assignee_id
require :title, as: :task_content
permit :due_date
permit :important, as: :starred
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment