No description, website, or topics provided.
Ruby JavaScript
Switch branches/tags
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.gitignore
Gemfile
MIT-LICENSE
README.rdoc
Rakefile
ar-column-as.gemspec

README.rdoc

ar-column-as

Adds a few simple helper methods that can be used with ActiveRecord::select.

Installation

gem install ar-column-as

Example

BlogPost.all(
  :select => [Sql.year(:published_at, :as => :year), Sql.month(:published_at, :as => :month), Sql.column_as('count(id)', :as => :posts)].join(', '),
  :group => [Sql.year(:published_at), Sql.month(:published_at)].join(', '),
  :limit => 12
)

This project uses MIT-LICENSE.