Skip to content

Allow type to be a model #597

@venkatd

Description

@venkatd

I don't have an idea for the best syntax but I find myself loading models from the params hash a lot. What if you were able to do something like this?

params do
    requires :user_id, identifies: User
end
get 'users/:user_id' do
   params[:user] # params calls User.find internally and raises the appropriate error if nothing is found
end

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions