Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

Nicolae Claudius's Profile

GitHub User: clyfe

Site: https://entrydns.net/

Comments by Nicolae Claudius

Avatar

Ransack is great for simple cases, however imho on more complex scenarios I'd rather write search from scratch, otherwise one ends up with those long names like name_matches_or_translation_name_matches that are somewhat unintuitive, and some even more complex scenarios cannot be expressed at all. So when search requirements bypass a certain threshold one should replace Ransack with a solution from scratch rather than fight it's API.

Avatar

I have a gist integrating Squeel with CanCan ( https://gist.github.com/1523940 ) that lets one do outer joins and less common operations:

ruby
# example domain names: domain.com, sub.domain.com

# in ability
can :manage, Domain, :permissions.outer => {:user_id => user.id}
can :manage, Domain, :name_reversed.matches => "#{domain.name_reversed}.%" # descendants

# in controller
@domains = Domain.accessible_by(current_ability) # or
authorize! :read, @domain

Hope Ryan will integrate it soon.