Closed asiniy closed 10 years ago
I can't see any purpose to break the BC. It's just a matter of taste and I'd rather stay with what we currently have.
How can I make a restriction for smth.like that:
@contractor = Contractor.restrict!(current_user).find(params[:id])
How can I work with restriction to this product?
What exactly are you trying to achieve?
I want to restrict user access to some contractors.
Ok. Use the code that you provided. Read README for better examples. Can you please explain what you want explicitly? How is it even connected to the way we use to reference entity?
I can't read your mind.
There is a controller:
@contractor = Contractor.restrict!(current_accreditation).find(params[:contractor_id])
@contractor.accreditations.create!(options)
So, I want to restrict
Contractor accreditation based on contractor itself.
For now, works something like that:
@contractor = Contractor.restrict!(current_accreditation, Contractor.find(:contractor_id)).find(params[:contractor_id])
@contractor.accreditations.create!(options)
ЗЫ. Можно мне по-русски, я по-английски не очень?
Is anybody here?
restrict!
does not accept second argument. It appears automatically during the restriction of a single entiy. Just use it.
Yes, I understood it for now. Regards!
Why we need to pass second argument in block? Maybe, it will be better to fetch self object from object through other way, like:
instead of current
i.e. carrierwave have a method naming
model
which can be used in their processing blocks