Sha256: ea749003b599f454dc73681d2db2e4d6a65ebd67861d10224794fe472baaee31

Contents?: true

Size: 1.32 KB

Versions: 9

Compression:

Stored size: 1.32 KB

Contents

= restful_query

http://github.com/quirkey/restful_query

== DESCRIPTION:

RestfulQuery provides a RESTful interface for easily and safely querying ActiveRecord data. 

== USAGE:

=== Rails/ActiveRecord:
  
  # as a gem, in environment.rb
  config.gem 'restful_query'
  
or install the plugin.
In your model:

  class Post < ActiveRecord::Base
    can_query
  end

In your controller:
  
  class PostsController < ApplicationController
    # ...
    def index
      @posts = Post.restful_query(params[:query])
    end
    # ...
  end

Now you can query your model via the URL:

  /posts?query[name][like]=jon&query[_sort]=created_at-desc

=== Sequel

Theres also a Sequel extension that works very similar to ActiveRecord::Base.can_query:

  require 'sequel/extensions/restful_query'
  
  DB[:posts].restful_query({'name' => {'like' => 'jon'}, '_sort' => 'created_at-desc'})
  <Sequel::SQLite::Dataset: "SELECT * FROM `posts` WHERE (name LIKE %jon%) ORDER BY `created_at` DESC">

=== More!

Please see the project homepage for detailed usage and info:

http://code.quirkey.com/restful_query

== INSTALL:

To install as a gem:

  sudo gem install restful_query
    
To install as a rails plugin
  
  ./script/plugin install git://github.com/quirkey/restful_query.git
  
== LICENSE:

Free for use under the terms of the MIT License - see LICENSE for details

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
restful_query-0.5.0 README.rdoc
restful_query-0.4.0 README.rdoc
restful_query-0.3.6 README.rdoc
restful_query-0.3.5 README.rdoc
restful_query-0.3.4 README.rdoc
restful_query-0.3.3 README.rdoc
restful_query-0.3.2 README.rdoc
restful_query-rails3-0.4 README.rdoc
restful_query-0.3.1 README.rdoc