search for: arel

Displaying 20 results from an estimated 124 matches for "arel".

Did you mean: are
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 lib/arel/nodes, doesn''t seem to have any node related to this, can arel handl this? Thank...
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 e...
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...
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...
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....
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`: > > rel_a = ActiveRecord::Relation.new(MyModel).where(:id => 3) > rel_b = ActiveRecord::Relation.new(MyModel).where(:id => 5) > new_rel = rel_a.union(rel...
2012 Apr 23
1
Searching and returning arrays
...th everything working. The facilities_hotels table is created with the facility_id and hotel_id collums, and the facilities table has for columns a facility_id and description(which is for e.g. pool, 24hroom service etc) The issue is in my model: def self.search(params) if params arel = where(''#searches for names/location/rating'') if params[:fc].present? arel=arel.joins(''INNER JOIN facilities_hotels ON hotels.id=facilities_hotels.hotel_id '') for i in params[:fc].size arel=arel.where(''facilitie...
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.a...
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 a...
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,...
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_ta...
2010 May 12
0
OT? Using Arel to generate table names in multiple self join query
...39;s fine insofar as it returns the desired result, but I am very unhappy with the prospect of having to hardcode assumptions about what the tables will be aliased with in the conditions and select (people, children_people, children_people_2, etc.). Is there some way I can write this making use of Arel so that the table names in the conditions are not hardcoded, and so is robust to a change in Arel''s naming algorithm? Thanks. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonra...
2010 Nov 15
1
Arel 2 isn't playing nice with my legacy tables
...g 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 received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core...
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...
2010 Dec 10
0
Encoding issues when uploading files
...ttached_file :image, :styles => {:thumbnail => "250x200#"} end When user tries to upload a file with name containing local characters and at the same time enters a description containg these characters, I get this error - only difference is, that it is burried somewhere deep inside AREL: incompatible character encodings: UTF-8 and ASCII-8BIT arel (1.0.1) lib/arel/engines/sql/relations/compiler.rb:85:in `join'' arel (1.0.1) lib/arel/engines/sql/relations/compiler.rb:85:in `insert_sql'' arel (1.0.1) lib/arel/algebra/relations/writes.rb:32:in `to_sql'' arel...
2011 Aug 14
5
Puzzled with form on multiple table rows
...uot;3MJ8aUhRWkrsOTLzkcLup8s7wrQH387H7uJeeKEU9Ss=", "utf8"=>"✓", "is_ten_event_ids"=>["5", "12", "20"]} User Load (0.2ms) SELECT "users".* FROM "users" WHERE ("users"."id" = 3) LIMIT 1 AREL (0.4ms) UPDATE "users" SET "last_access" = ''2011-08-14 18:37:42.858005'', "updated_at" = ''2011-08-14 18:37:42.858858'' WHERE ("users"."id" = 3) Event Load (0.6ms) SELECT "events".* FROM "events&qu...
2012 Apr 18
2
RoR - Search Forms with Checkboxes, display appropriate results
...add checkbox fields for each facility I have and in the search form, when the user selects it and presses Search, it should only display the hotels which have those facilities. I''ve searched but i can''t put it to work. My hotel model: def self.search(params) if params arel = where(''city LIKE ? OR name LIKE ?'', "%#{params[:search]}%", "%#{params[:search]}%") arel = arel.where(''rating = ?'', params[:rating]) if params[:rating].present? (what to put here?) arel else all end end My...
2010 Nov 16
6
rails 3.0.3 and visit_CoercibleString errors
From having no errors with 3.0.2 I now see lots of these errors when running my tests. undefined method `visit_CoercibleString'' for #<Arel::Visitors::MySQL: 0x000001074f4298> Anyone know what this is? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscr...
2010 Sep 27
0
problem with set_sequence_name please help
...dbc-adapter-0.9.7-java/lib/active_record/connection_adapters/jdbc_adapter.rb:578:in `select_one'' from /Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/activerecord-jdbc-adapter-0.9.7-java/lib/jdbc_adapter/jdbc_oracle.rb:163:in `insert'' from /Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/arel-1.0.1/lib/arel/engines/sql/engine.rb:30:in `create'' from /Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/arel-1.0.1/lib/arel/algebra/relations/writes.rb:24:in `call'' from /Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/arel-1.0.1/lib/arel/session.rb:17:in `create'' from /Users...
2010 Nov 24
0
Surprise in (delete_all | clear | destroy_all) on association
...TaskFilter.first.qualifiers.delete_all => TaskFilter Load (0.9ms) SELECT `task_filters`.* FROM `task_filters` LIMIT 1 TaskFilterQualifier Load (0.9ms) SELECT `task_filter_qualifiers`.* FROM `task_filter_qualifiers` WHERE (`task_filter_qualifiers`.task_filter_id = 1) SQL (0.2ms) BEGIN AREL (6.6ms) DELETE FROM `task_filter_qualifiers` WHERE (`task_filter_qualifiers`.`id` = 92) TaskFilter Load (6.4ms) SELECT `task_filters`.* FROM `task_filters` WHERE (`task_filters`.`id` = 1) LIMIT 1 AREL (0.6ms) UPDATE `task_filters` SET `updated_at` = ''2010-11-24 09:28:03'' WH...