Displaying 20 results from an estimated 1200 matches similar to: "[Arel]Building query, but can't get a proper output"
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 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
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
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 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'',
2011 Apr 18
12
Arel - clone bug (and fix), feature requests
Hi all,
I''ve been playing around with Arel this week (actually outside of Rails)
and found an issue with the clone implementation. I''ve added a patch and
a testcase here:
https://github.com/codders/arel/commit/660f706491ac012cb133554cffeaa6b9ae6046e9
and made a pull request against the rails/arel repo.
I''ve also been playing around with support for ordering on
2012 Dec 18
1
Arel limit Where if fields are present
I trying to create a select using Arel but I''m passing three parameters, I
want to include the parameters only if they are different to nil or blank.
Here is my method:
def self.advsearch(summary_description, specialties, place)
User.joins(:experience,:summary,:information)
.where(Information.arel_table[:business].eq(false))
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 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
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`:
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
2012 Apr 23
1
Searching and returning arrays
im a begginer in RoR and am using rails 3.2.3 and ruby 1.8.7
This forum has helped me to progress but I''m confused by one thing.
My app is supposed to allow seaching for results depending on the check
boxes that are checked. In my case, when the user checks a determined
facility and clicks "search" the corresponding hotels with only those
facilities should be returned. I can
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
2012 Apr 18
2
RoR - Search Forms with Checkboxes, display appropriate results
I have a form that allows me to search a hotel by city or name and by
rating through radio buttons. It all works.
However, my hotel model has_one :facility, this facility model is
composed by several boolean fields (for example, roomservice:boolean
restaurant:boolean and so on)
The question is, I want to add checkbox fields for each facility I have
and in the search form, when the user selects
2011 Aug 14
5
Puzzled with form on multiple table rows
I''ve got a table of events, and each event has a boolean attribute
is_ten_event.
On each row of the table is a chekbox to edit the value of is_ten_event,
so that multiple rows can be edited with one submit.
In order to allow boxes to be un-checked as well, the logic in the
controller works like this
get array of events from checkboxes that are ticked.
make all events.is_ten_event =
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
2011 Feb 08
4
Remove ActiveRecord::Relation#& alias for 'merge' ? (or at least only reference and not use in AR)
Would the core team be open to the removal of the ''&'' alias for
ActiveRecord::Relation#merge?
The reason is that in Ruby the ''&'' operator refers to an intersection
of two sets of data, not a merge. (within the context of the Array
class)
Recently Arel added support for SQL Set Operators:
2-0-stable:
2010 Aug 28
1
Alternative to merge_conditions in Rails 3
merge_conditions seems to be gone from rails 3. Is there something in
Rails 3 or Arel that would allow me to achieve the same thing, which
is to merge various types of conditions (array, hash, etc)? I haven''t
spent much time with Arel, so I may be missing something obvious.
Thanks
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: