GitXplorerGitXplorer
a

active-model-union

public
1 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
e758e6dc059a6a4c9cabf12d4bf873619a883a6b

Fixed no spaces between sql sentences

aandresbravog committed 11 years ago
Unverified
fe87b117d6185a42c81bbf353b2b38630d3bf880

Fixed no spaces between sql sentences

aandresbravog committed 11 years ago
Unverified
15c3965324e627b8c86d05b408c0978129b771ea

Added paginate specs

aandresbravog committed 11 years ago
Unverified
c4149d1af2320a49729d376f3ee96e2f13b95c68

Added offset and limit specs

aandresbravog committed 11 years ago
Unverified
5f8cc3578b56645199b5ada2966cf9435cb857da

Deleted Coveralls

aandresbravog committed 11 years ago
Unverified
5ae759546437d8d0f7ce4382a8f0a3cdb0504de4

Added badges

aandresbravog committed 11 years ago

README

The README file for this repository.

Code Climate Build Status

ActiveModelUnion::Base

New ActiveModel class base that allows you to define n different ActiveRecord models to search from:

class User < ActiveRecord::Base
  attributte_accessor :name, :email, :login
end

class Organization < ActiveRecord::Base
  attributte_accessor :name, :email, :description
end

class YourNewClass < ActiveModelUnion::Base
  union_model :user, :organization

  union_attribute :name, :email, :login
end

YourNewClass.where(email: 'me@gmail.com' ).all

ActiveModelUnion::Relation

Relation model that allows us to chain operations as union on to each one of the union models. Right now we have:

  • where
  • limit
  • order
  • joins
  • count
  • to_sql
  • all
  • paginate

We can aditionally make some of the operations just in one of the union models by using the _in methods:

YourNewClass.where_in(:user, email: 'me@gmail.com' ).all

right now we have:

  • where_in
  • joins_in