support for active hash model adapter #821

Closed
wants to merge 1 commit into from

2 participants

@robhurring

Not sure if this is outside the scope of cancan, but I had a need in my current project for stubbing out resources using active hash (ActiveYaml more specifically) before they could be backed by a proper DB and noticed there was a lack of support. This PR allows you to treat active hash objects like regular model classes in the controller and allows for:

# model
class Mock::Stadium < ActiveYaml::Base
  set_filename 'stadiums'
  fields :name, :city, :state
end

# controller
class Api::V1::StadiumsController < Api::V1::BaseController
  load_and_authorize_resource class: Mock::Stadium
end

Currently it only supports basic scoping and no associations.

@xhoy

Thanks for your submission! The ryanb/cancan repository has been inactive since Sep 06, 2013.
Since only Ryan himself has commit permissions, the CanCan project is on a standstill.

CanCan has many open issues, including missing support for Rails 4. To keep CanCan alive, an active fork exists at cancancommunity/cancancan. The new gem is cancancan. More info is available at #994.

If your pull request or issue is still applicable, it would be really appreciated if you resubmit it to CanCanCan.

We hope to see you on the other side!

@robhurring robhurring closed this Mar 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment