Questions tagged [squeel]

Squeel is a "database toolkit" for the Ruby programming language. It extends Active Record with a handy block-based syntax.

Squeel is a "database toolkit" for the Ruby programming language.

It extends Active Record with a handy block-based syntax.

Squeel is available via rubygems.org, the code is available at github.

Examples canm be found at the project website is http://erniemiller.org/projects/squeel

Sequel was primarily developed by Ernie Miller. It is not maintained by him anymore.

Don't mix up squeel with sequel.

128 questions
0
votes
1 answer

ruby on rails join conditions (with squeel)

I'm trying to use Squeel to compare attributes among the joined tables along with a little math. Here's an example of the query: Parent.joins{[child1, child2.grandchildren]}. where{grandchildren.birth_datetime > Time.now - child1.age.years} I get…
joshblour
  • 1,024
  • 10
  • 19
0
votes
1 answer

Time calculations in Rails where statement

I'm trying to make some time calculations in where statement. I would like to select offers which life time has already past. select_offers = Offer.where { (published_time + life_time) < DateTime.now } It doesn't throw any error but it also…
Jaro
  • 860
  • 9
  • 21
0
votes
2 answers

Chaining multiple scopes with different joins to same table in squeel

This problem is occurring on squeel 1.0.11. I have submitted an issue but thought the community may have an answer already. I have two relationships to the same table in my model, and I'm using those two relationships in the join of two different…
barelyknown
  • 5,510
  • 3
  • 34
  • 46
0
votes
0 answers

How to do a joins with the result of an array using squeel

I have squeel installed and would like to do the following: @branches = Branch.near(@latlon) #This provides an array of nearby branches @dispensers = Dispenser.joins{@branches} #This does not work I could geocode my dispensers, but I'd generally…
Abram
  • 39,950
  • 26
  • 134
  • 184
0
votes
1 answer

Difference between Squeel and Arel?

Can anyone explain the difference between the two very similar looking gems 'Arel' and 'Squeel' for a rails newbie. https://github.com/rails/arel Vs https://github.com/ernie/squeel I am looking forward to building a simple Query builder where user…
Nitish Upreti
  • 6,312
  • 9
  • 50
  • 92
0
votes
1 answer

Rails HABTM association

I have self reference habtm assotiation. class Label < AR::B has_and_belongs_to_many :a_label, :class_name => "Label", :join_table => "a_labels", :foreign_key => "label_id", :association_foreign_key =>…
0
votes
2 answers

Why doesn't Rails where clause return results with boolean condition?

I have the following squeel query: i = Invoice.where{ paid == true } that's the same as: i = Invoice.where ['paid = ?', true] and executes: SELECT "invoices".* FROM "invoices" WHERE "invoices"."paid" = 't' However, this query doesn't return any…
Jasper Kennis
  • 3,225
  • 6
  • 41
  • 74
0
votes
1 answer

Trying out Squeel but symbols don't seem to work

I'm trying the following query results = Tickets.order("created_at DESC").where({ (title =~ params[:title]) & (name =~ params[:from]) | (problem =~ params[:includes]) & (problem !~ params[:excludes]) }) but the following error…
Joseph Le Brech
  • 6,541
  • 11
  • 49
  • 84
1 2 3
8
9