Skip to content

Loading…

has_one nested resource doesn't work #93

Closed
nirvdrum opened this Issue · 2 comments

2 participants

@nirvdrum

It looks like CanCan always assume a nested resource's parent has_many of the resource and structures its queries accordingly. As a result, nested has_one resources fail to load properly.

@ryanb
Owner

adding :singular option to support has_one associations in load/authorize resource - closed by 84f4c90

@ryanb
Owner

Once CanCan 1.3 is released you can use it like this.

class OrdersController < ActionController::Base
  load_and_authorize_resource :cart
  load_and_authorize_resource :order, :through => :cart, :singleton => true
end
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.