Displaying 20 results from an estimated 1200 matches similar to: "Searching and returning arrays"
2006 Feb 23
4
looping
I have a form that prints fine for one particular criteria...
facility_id = "X"
controller code looks like this...
def fac_log
@facility = Facility.find(params[:report][:facility_id])
@placement = Placement.find(:all,
:conditions => [ "facility_id = ? and discharge_date IS NULL,
params[:report][:facility_id] ]
)
end
I can print out the form
2006 Jun 26
2
Prototype Ajax event handlers
I''ve been trying to use the prototype.js Ajax obect''s event handlers (onCreate, onComplete) inside the options tags as
below:
function updateCalendar(today, id){
new Ajax.Updater("calendars", "calendar.inc.php",
{asynchronous: true,
onCreate: function(){ showBusy },
onComplete: function(){ hideBusy },
method: "get",
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
2006 Feb 18
1
sql logic is killing me
I know my thinking is sloppy.
I want to know how many clients currently in my facility are male...
My facilities_controller.rb
def list_fac
@placement_pages, @placements = paginate(
:placements,
:conditions => ["placements.facility_id = ?",
params[:facility_id] ],
:include => [:facility, :client],
:order_by => ''facilities.name,
2007 Oct 25
1
find - group - postgres
I am not sure that this is entirely a rails question as I am trying to
run the command in postgres and I am getting the same error...
controller code...
@client_slot_count = ClientSlotsDaily.find(:all,
:conditions => ["created_at > ? AND created_at < ? AND
facility_id = ? AND client_id IS NOT NULL",
starting_date, ending_date, @facility.id],
2006 Feb 28
2
sorting collection lists
I''m using collection.select lists and I would love to sort them by one
or two of the columns as the lists are getting long enough to make a
difference.
<%= options = [[''Select a Facility'', '''']] + @facility.collect {
|fac| [fac.name, fac.id] }
select ''placement'', ''facility_id'', options %>
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 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 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
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
2005 Jun 16
3
PostgreSQL Scaffold Doesn't Insert PK?
I am new to Rails and Ruby. I''ve been a WebObjects developer for a few years
and before that J2EE (shudder). I wanted to try RoR so I am porting an
existing Web app.
I am running the latest release on Tiger and PG8.
Right now my single table has three attributes:
id | integer | not null
hotel_name | character varying(255) | not null
hotel_location |
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 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 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 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:
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 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
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
2012 Aug 10
1
Merge scopes with OR
I''d be quite interested in a feature merging scopes with OR - currently the
default way is AND.
The feature seems to have been requested/reported here:
https://github.com/rails/rails/issues/5545
A pull request was sent, but it needs some work.
I wrote a quick attempt too here: https://gist.github.com/3312792
It uses the syntax:
Jobship.includes(:job).or(Jobship.accepted,