Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
app
 
 
bin
 
 
 
 
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

LiquidQueries

Perform queries on your ActiveRecord collections directly from Liquid templates with the help of Ransack.

Usage

Add a method to a drop that returns a collection:

class MyDrop < Liquid::Drop
  def users
    LiquidQueries::Collection.new(collection: User.all)
  end
end

Then do something like this in your Liquid template:

Kasper's ID is: {{ my_drop.users.ransack.first_name_eq.Kasper.first.id }}
Kasper's last name is {{ my_drop.users.ransack.first_name_eq.Kasper.first.last_name }}

Or something like this:

Users with a name that contains "kasper":

{% for user in my_drop.users.ransack.name_cont.kasper.to_a %}
  {{ user.id }} - {{ user.first_name }} {{ user.last_name }}
{% endfor %}

Installation

Add this line to your application's Gemfile:

gem 'liquid_queries'

And then execute:

$ bundle

Or install it yourself as:

$ gem install liquid_queries

Contributing

Contribution directions go here.

License

The gem is available as open source under the terms of the MIT License.

About

Perform queries through Ransack in Liquid templates

Resources

License

Releases

No releases published

Packages

No packages published
You can’t perform that action at this time.