Checking permissions on decorator in view #886
Unanswered
janpeterka
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I know this has been opened multiple times here (#255 , #327), but as that is old, and around Draper, I though I might open new discussion here.
I use decorated objects in my views, such as
class EventDecorator < SimpleDelegatorAnd in view, I need to check whether to show button with action (edit, delete,..) via
can?.However, that doesn't work, as I my Abilities I define it for
Event.Now, I could change all my rules to
[Event, EventDecorator], but it goes against duck typing in my opinion - in my views I approach my decorated object same as the original.I tried to force my EventDecorator to behave like Event for cancancan, but I didn't manage it.
Is there a way to do this in duck-typed manner?
Beta Was this translation helpful? Give feedback.
All reactions