Displaying 20 results from an estimated 500 matches similar to: "Arel limit Where if fields are present"
2012 Jan 03
1
Can Arel handle UPPER and LIKE condition?
Hello all, I''ve recently been on a project where somewhere needs
using case insensitive search(using UPPER(name) LIKE '''') and LIKE condition,
I want to use arel and don''t use the old style string concatenation,
can arel handle this?
But I check on arel documentation, doesn''t seems have any upper/like
operator,
and check on arel source, under
2010 Jun 20
0
ActiveRecord and ARel: correlated subqueries?
I''m trying to figure out how to use ActiveRecord in conjunction with
ARel. In particular, I''d like to replace my residual literal SQL with
ARel, if only I could see how.
Let''s take Article with multiple Versions as an example. With ARel
alone, I can find articles with their latest versions like this
articles = Article.arel_table
versions = Article.arel_table
2011 Nov 03
0
Arel table aliases and ActiveRecord::Relation help: how to specify "multiple has_many items in a query"
What is the recommended way to use table aliases with
ActiveRecord::Relation these days?
In prior versions of Rails, this would work:
assume (pseudo code):
model A
has_many b''s
model B
,,,
at = B.arel_table
atalias = at.alias(at.name + "_1")
A.join(:b).join(atalias).where(atalias[:a_id].eq(at[:a_id]).where("b.widget
=
2011 Nov 22
4
A "strict Arel" mode for ActiveRecord to prevent SQL injection vulnerabilities
Hello rubyonrails-core,
I’ve been looking into possible changes to ActiveRecord / Arel to make it
easier to write Rails applications that are free of SQL injection
vulnerabilities, and in particular do so in a way that makes it easy for a
code reviewer to verify that the app is safe from such bugs.
The concern:
-----------------
With the ActiveRecord API as is, it’s relatively easy to write
2012 Sep 19
0
How to copy model with arel_table instance
Hi all
I want to make copy of current scoped object, then change some stuff in
arel_table(i need to change table_alias, because i have complicated query)
and arel(SelectManager)
def self.do_smth
query = scoped.dup
puts query.arel_table.object_id == scoped.arel_table.object_id # true
end
Theoretically i can dup arel(SelectManager) but i can not find how to add
table alias to that instance
2011 Jul 25
5
Arel quiz: complex queries with associations
I have a real-world application with some complex queries that I want to
convert to Arel (as part of an upgrade to Rails 3.1). So that I can
understand what I''m doing before I flail around in my real app, I wrote
a little sample app (just the models) with some similar associations --
one table joined with itself and more tables that join to another table,
so there are some queries that
2006 May 08
8
enforcing special behavior of child rows in HABTM
Hi,
I have a scenario where a doctor can have one or more specialties.
For each doctor, one and only one of her specialties can be designated
as primary.
So I have tables called doctors, specialties, and doctors_specialties,
the last of which has a boolean is_primary column.
The doctor model class specifies that:
has_and_belongs_to_many :specialties
I want to enforce, at the lowest possible
2011 Sep 26
1
Restructuring data - unstack, reshape?
Hi all,
I'm having a problem restructuring my data the way I'd like it. I have data
that look like this:
Candidate.ID Specialty Office Score
110002 C London 47
110002 C East 48
110003 RM West 45
110003 RM
2011 Jul 19
1
Lattice plot problem outputting to jpeg
Hi.....I am relatively new to R but was quite pleased with myself at having
generated a series of lattice plots as PDFs. I was very surprised when
plotting these out as jpegs (or png or tiff) that the strip title
information above each lattice plot vanished. The pdf was fine. Has anybody
any ideas? I can't add an image as the information is sensitive.
Many Thanks
Steve Creamer
Here is the
2011 May 11
2
Issue with Arel::SelectManager and insert Method
Hello,
Arel::SelectManager (arel 2.0.9) uses following statement to insert a
new record:
@engine.connection.insert im.to_sql, ''AREL'', primary_key_name,
primary_key_value
But in DatabaseStatements insert ist defined as:
insert(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)
Actually, Arel::SelectManager does not use the sequence name. This
leads to issues
2011 Apr 10
0
Arel Union does not support #order or #limit
I just posted this ticket in Lighthouse, but thought perhaps some
discussion here would help point me in the right direction toward a
solution. Here is a description of the problem (from the ticket - https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/6693-arel-union-does-not-support-order-or-limit)
:
> If we take two `ActiveRecord::Relations` and join them via `union`:
2012 Mar 13
2
[Arel]Building query, but can't get a proper output
I have the following code:
advertisements_arel = Advertisement.order("advertisements.id
DESC").arel
@advertisements = (params[:website_id].present? ?
advertisements_arel.where(:website_id => params[:website_id]) :
advertisements_arel).to_a
It returns a struct Arel::SelectManager::Row data
But I''d like it to return an array of Advertisement objects (like it
would
2011 Jun 04
0
Rails 3.1 : Complex database query with Arel 2
Hi,
I''ve search for documentations on queries with Arel 2 but there is
pretty nothing and all I''ve found is for Arel 1 so I''ve run into
NoMethodError: undefined method `[]'' for
#<Arel::SelectManager:0x00000003f1b820> errors with join syntax.
My query is barely simple but involve nesting queries. I have 4 tables.
Assets, Deposits, Orders and OrderLines
2010 May 12
0
OT? Using Arel to generate table names in multiple self join query
Firstly I''m sorry if this is off-topic but I think it''s a question
that won''t be answered without good core knowledge.
I have written a multiple self join query something like this:
Person.find :all,
:select => ''children_people_3.*'',
:joins => { :children => { :children => :children } },
:conditions => {
:people => { :name
2011 Apr 14
0
arel engine
I want to write an arel engine to run an arel-based client against a RESTful
back-end.
I''ve seen people talk about it, but haven''t seen it actually done.
Is it possible? What is the best place to find info/examples on how to do
it?
tx, Andy
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this
2010 Nov 15
1
Arel 2 isn't playing nice with my legacy tables
Specifically, it''s not playing nice with any type that it doesn''t recognize,
eg. SET, ENUM, etc..
Just trying to start my Rails 3.0.2 app I get a NotImplementedError
exception "Column type `` is not currently handled" on the first SET field
it encounters.
Am I missing something here? Should I be disabling Arel for legacy tables
or something?
Thanks,
Jason
--
You
2011 Feb 22
0
Arel: misunderstanding with intersections
Hi,
I''ve been playing with Arel for a few days, but I feel really confused
about predicates / arrays intersection.
Let''s say I have 3 models: users, (bank) accounts and transfers. An
account belongs to a user, and a transfer is made of a source and
target accounts (see the snippets below).
Given a user, I want to query his transfers. I can go this way in the
User class:
def
2006 Jan 04
3
SIP/IAX softphones for use in call centre environments
I've been working my way through the softphones listed on voip-info over the
last few weeks and I've not really found anything to fit the bill. Has
anyone had more luck?
The environment is a small call centre of 5 users. Operators often need to
be able to transfer calls to other operators with different specialties, so
the softphone needs to be easy to use and quick to transfer calls.
2004 Mar 16
1
rights or read only
NetWare 6 sp4 server to windows 2000 server using cwrsync 1.2.1
when the cwrsync service writes the files to the server it uses it's
own username and permissions. Does anyone have any suggestions as to
how I can get this to write the files so common users and delete and
change stuff? would the perverse permissions work with windows?
Thanks,
Matt Vorwald
Network Engineer
Lumber
2011 May 05
9
[threadsafe] Arel ToSql visitor is not threadsafe
Hey,
We hit a bug today because Arel::Visitors::ToSql is not threadsafe.
Here is what is happening:
Arel::Visitors::ENGINE_VISITORS is a cache of visitors instances.
These instances are not inherently threadsafe because it contains
state ''@last_column'', ''@connection'' that is shared between threads.
The other variables ''@pool'',