Displaying 20 results from an estimated 600 matches similar to: "Issue with Arel::SelectManager and insert Method"
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
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 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 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'',
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))
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 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
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
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
2010 Nov 12
1
SEXPs and slots
Hello,
I've created this class:
setClass("example",
representation (
size = "numeric",
id = "character"
)
)
Suppose I create a new instance of this class:
> x <- new("example", 4, "id_value")
This creates an S4 object with two slots. Am I correct in thinking that
slots are "filled" by SEXPs?
2010 Aug 05
3
how to ? Rails 3 ActiveRecord eager loading and AREL
Hello everyone,
I would like to eager load scoped records to avoid queries executed in a
loop (huge performance impact).
The "scoped" part is what is giving me a hard time.
I''m using Rails3 RC.
Does anyone have any idea how I can do it?
Here is a test case : we have an "Article" and a "Comment" Activerecord
models,
article has many comments
comment
2007 Jan 18
4
Defining the expected behavior of DatabaseStatements.execute()
It would be very helpful if the core team could define and document
the expected behavior of DatabaseStatements.execute(). The
implementations appear to vary. Most adapters will return some sort of
native result set, SQL Server returns nil and expects a block, DB2 and
Sybase return the affected row count.
So please, will someone in core explain the expected behavior and can
the execute()
2008 Jun 11
2
starting record id is 10000 in oracle 10g ,why ?
i create a new model(User) and create a new record
(User.create(attributes)) in oracle
when i check User.find 1 in console
it gives record not found error
when i try
User.find(:first).id --> 10000
how to change this starting id into 1 ....
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to
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
2006 May 15
8
set_table_name and self.table_name
I have some legacy tables that I used set_table_name on, I''m attempting
to write a method that will get key value from a sequence table and then
update it and return a value. I''m hoping to put this in the base
ActiveRecord method so I would like to reference the table name with
self.table_name or something...
class Contacts < ActiveRecord::Base
set_table_name
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
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