Skip to content
This repository has been archived by the owner on Jun 5, 2024. It is now read-only.

Loses the ability to use rails strong params #9

Open
alexandru-calinoiu opened this issue Jul 15, 2015 · 8 comments
Open

Loses the ability to use rails strong params #9

alexandru-calinoiu opened this issue Jul 15, 2015 · 8 comments

Comments

@alexandru-calinoiu
Copy link

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.

@tdantas
Copy link
Owner

tdantas commented Feb 9, 2016

@joaquimadraz could you see that ?

@tdantas
Copy link
Owner

tdantas commented Feb 18, 2016

@alexandru-calinoiu still an issue to you ? let me know !

cheers

@joaquimadraz
Copy link
Collaborator

@tdantas Sorry for the delay. I haven't check this issue. Next couple of weeks will be busy for me. Can you check that?

@tdantas
Copy link
Owner

tdantas commented Feb 18, 2016

take your time @joaquimadraz.

@joaquimadraz
Copy link
Collaborator

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!

@alexandru-calinoiu
Copy link
Author

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?

@joaquimadraz
Copy link
Collaborator

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?

@tdantas
Copy link
Owner

tdantas commented Apr 1, 2016

👍 looks great !

another heads up.
testing is failing on 1.9.3 ruby version, can you see that ?

cheers

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants