Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Support for multiparameter attributes (used by datetime_select and time_select) #717

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
4 participants

Fixes issue #634

When using a datetime_select or a time_select, the attribute is split into multiple parameters (one per select tag) like {"date(1i)"=>"2012", "date(2i)"=>"8", "date(3i)"=>"12"}

This allows datetime_select and time_select to work as expected by making
@ability.can :update, :article, :date
allow

@ability.can? :update, :article, 'date(1i)'
@ability.can? :update, :article, 'date(2i)'
@ability.can? :update, :article, 'date(3i)'
@jhawthorn jhawthorn Support for multiparameter attributes
Multiparameter attributes, like those used with datetime_select and
time_select are understood, and the parenthesized portion is stripped
when checking permissions.

For example:
  @ability.can :update, :article, :date
will allow
  @ability.can? :update, :article, 'date(1i)'
  @ability.can? :update, :article, 'date(2i)'
  @ability.can? :update, :article, 'date(3i)'
1728080

This pull request passes (merged 1728080 into aed9f26).

ivanyv commented Apr 20, 2013

Personally I don't see in what situations this is useful (why would you check if you can update a part of the date?), but pull looks clean.

xhoy commented Apr 10, 2014

Dear submitter, Since cancan/raynB hasn't been active for more than 6 months and no body else then ryam himself has commit permissions the cancan project is on a stand still.
Since cancan has several issues including missing support for rails 4 cancan is moving forward to cancancan. More details on: #994

If your feel that your pull request or bug is still applicable (and hasn't been merged in to cancan) it would be really appreciated if you would resubmit it to cancancan (https://github.com/cancancommunity/cancancan)

We hope to see you on the other side!

@jhawthorn jhawthorn closed this Aug 19, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment