Utusemi

Build Status Code Climate Coverage Status Dependency Status

Providing a flexible alias for column names in ActiveRecord.

Installation

  1. Add utusemi in the Gemfile:
  gem 'utusemi'
  1. Download and install by running:
  bundle install

Usage

  1. Create a file named utusemi.rb in config/initializers and add column names in this file.
  Utusemi.configure do
    map :sample do
      name :first_name
    end
  end
  1. Use utusemi method.
  irb> User.utusemi(:sample).where(name: 'John')
  SELECT "users".* FROM "users" WHERE "users"."first_name" = 'John'

Requirements

  • Ruby on Rails 3.2, 4.1
  • Ruby 2.1

Development

To set up a development environment, simply do:

bundle install
bundle exec rake db:create
bundle exec rake db:migrate
bundle exec rake  # run the test suite