Comments (13)
Sounds good
from cancancan.
I definitely think we should drop meta_where support in favour of just supporting AREL conditions. This would be a breaking change though and have to be wrapped up in a 2.0 release, which I'm not quite prepared to do yet (most due to #14).
I will keep this open as you've already done most of the hard work of identifying what can be pulled out.
Thanks!
from cancancan.
What about switching to support squeel?
If it helps, I've done some integration ages ago.
from cancancan.
Squeel has many problems with ActiveRecord 4 when dealing with complex queries and I think it's not actively devloped any more
from cancancan.
I love squeel as well, but I don't think its support should be baked into CanCanCan. I would like to make sure CanCanCan accepts AREL conditions... so you can choose to use Squeel if you want, but not have to support it directly in this library.
from cancancan.
@bryanrite Fair enough. I like Squeel a lot, but baking in support for it was never a popular feature anyway.
from cancancan.
I do not completely agree. Looks like squeel is still supported, isn't it? And since I do not see many alternatives, I would like to switch to it. @legendetm why do you say that it has many issues?
I agree in dropping MetaWhere support, anyway.
from cancancan.
At the time when I wrote the comment, squeel had many bugs with ActiveRecord 4 for a long period. Now squeel has new maintainer who has fixed those problems.
from cancancan.
I don't think we need to support Squeel in Cancancan core, if a project has Squeel in it, they can specify Squeel conditions in scopes which can be used in the ability file. Building a DSL for Squeel in Cancancan, at least the core, doesn't feel right to me. I could start a cancancan-squeel project under CanCanCommunity if anyone wanted to tackle it that way?
from cancancan.
I agree with you @bryanrite. A cancancan-squeel project separated from the core looks like a good solution.
from cancancan.
Has anyone managed to get Cancancan working with Squeel on Rails 4.2? I've used this gist and have my ability tests working, but I'm getting a load of missing column & table errors when I load_and_authorize_resources in my controllers. So I suspect there's some change to Rails which means ControllerResource needs changing. Any ideas or guidance would be great. Thanks.
from cancancan.
Another option is to replace metawhere with ransack support, which has almost the same syntax.
Having an easy serializable format for more advanced rules is definitely important if you want to store rules in the database.
from cancancan.
Gone
from cancancan.
Related Issues (20)
- Polymorphic associations do not support computing the class HOT 12
- STI normalizer fails when existing rule conditions are relation HOT 2
- undefined method `#{parent_name}=' for singleton associations
- Nil values on enums fails to authorize
- Gemspec does not have Rails version dependency for various version of the gem
- cancancan is chaninging my get request ID HOT 1
- Deep conditions nesting on sqlite => stack overflow
- Selective permissions on STI sub-classes not respected by accessible_by HOT 1
- Granting read permission on intermediate STI table prevents any records being returned HOT 4
- inconsistent behaviour with Hash subjects
- `can?` unnecessarily loads relationships in memory when it could leverage `accessible_by` HOT 1
- can? should return false when there are no attributes that the current user can perform action on
- Possible breaking change with handling of `nil` conditions in 3.5.0
- How to define ability action name that is same as the default action aliases?
- Why are merged rules still bound to the merged Ability class?
- Extra table alias is being generated, but then ignored in the final stage of an accessible_by query HOT 1
- Creating resource failes when association is polymorphic and singleton.
- Can't apply rules to `create` action without affecting `new` because of aliasing HOT 12
- Resource Loader gets ignored with Whitespace-Only ID in URL (e.g., "\n")
- Support Rails's `attribute` in Cancancan's `permitted_attributes` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cancancan.