squeel
squeel copied to clipboard
Active Record, improved. Live again :)
In v1.1.1 the following code was called: ``` def visit_ActiveRecord_Base(o, parent) o.id end ``` In my application, i need to override this method on a per-class basis: ``` def visit_ActiveRecord_Base(o,...
Models: ``` class Car < ActiveRecord::Base has_many :parts end class Part < ActiveRecord::Base belongs_to :car default_scope { where { something == 5 }.where { whathever == 'foo' } } #...
This is very speculative so I'd appreciate if @bigxiang could take a look. You can see my failing test in the pull request. The gist is that this is broken:...
Is there a way so do this in squeel: ``` sql SELECT 1 AS one FROM `table_name` WHERE id = '1' ``` If not, I'd like to put this in...
`.preload` takes keypaths in its DSL form, but it doesn't seem to handle the type discriminators on polymorphic associations: ``` ruby ModelA.preload do [ something_polymorphic(SpecificTypeB).relation_only_available_on_that_type, something_polymorphic.available_on_all ] end ```
I am getting [this](https://gist.github.com/juanpastas/e4ccbf649d41c9bc5645). My Gemfile: ``` ... gem 'ransack', github: 'activerecord-hackery/ransack', branch: 'rails-4.1' ... gem 'squeel', :git => "git://github.com/activerecord-hackery/squeel.git" ... ``` I am using ransack for search forms and...
I'm attempting to perform a [row-wise comparison](http://www.postgresql.org/docs/8.1/static/functions-subquery.html) (9.16.6 at the very bottom) subquery using squeel. I've managed to hack it together with this. ``` ruby message = select('created_at').where{ id.eq(my{message_id}) }.to_sql...
I use globalize (https://github.com/globalize/globalize) to implement multiple language. So, my database structure like: ``` projects: type_id project_translates: project_id title desc ``` When i use code below: ``` Project.joins(:translations).where{translations.desc.like(my{keyword})} ``` I...
Operators don't work on sifters, so you always have to wrap them like so: `_(sift(:my_sifter))`. This is a patch I made that always returns the Sifter object wrapped withing Grouping....