Loses the ability to use rails strong params
With the context wrapping the params, require does not work anymore, how about adding the require in the Context.
Does it sound like a good idea? I can put a PR if you want.
@joaquimadraz could you see that ?
@alexandru-calinoiu still an issue to you ? let me know !
cheers
@tdantas Sorry for the delay. I haven't check this issue. Next couple of weeks will be busy for me. Can you check that?
take your time @joaquimadraz.
Hey @alexandru-calinoiu! Sorry, I need some context to help you on this one.
Isn't require used to whitelist params sent to a server? How is that related with the usecasing context?
Can you give me a use case using require on Context?
Thanks and sorry for the late response!
The idea is I want to implement some sort of a contract for my context.
So if the before method for a use case I ca do:
def before
context.requires(:current_user)
end
Does this make sens?
Most of the times, I validate the context and if something is missing I just call stop!.
If something like this should exist, maybe as class method?
class FindInvoice < UseCase::Base
required_context :current_user, :invoice_id
def perform
...
end
end
@tdantas what do you think?
:+1: looks great !
another heads up. testing is failing on 1.9.3 ruby version, can you see that ?
cheers