Displaying 20 results from an estimated 11000 matches similar to: "question about a where condition"
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
2013 Apr 03
2
strange behavior with active relation any? method
In console, I run the following and any? returns true:
drivers = Driver.select("drivers.*,
drivers.id").joins([:reports, :driving_habits]).where("extract(MONTH
FROM reports.time) = ? AND extract(YEAR FROM reports.time) = ?", 3,
2013).uniq.order("drivers.id asc").page(2).per(1)
drivers.any?
=> true
This correctly evaluates to true because the relation contains one
2010 Jul 08
25
Prepared SQL statements
Dear all great developers.
I wonder if there is any work being done or thoughts being shared
regarding prepared SQL statements.
Currently I am in heavy need of tuning SQL INSERTS that insert large
(3MB) images into blobs.
I am using rails 2.3.5 with postgres adapter and pg driver.
Any information would be appreciated.
Jarl
--
You received this message because you are subscribed to the
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))
2006 Dec 05
4
has_many with :uniq not working for me
Hi all,
I have a relationship (no really!)
class RiskMatrix < ActiveRecord::Base
has_many :severities, :order => :position, :uniq => true
end
class RiskFactor < ActiveRecord::Base
belongs_to :risk_matrix
validates_presence_of :descriptor, :example
validates_uniqueness_of :descriptor, :example, :scope=> :risk_matrix_id
end
class Severity < RiskFactor
2007 Jul 24
11
Mock or Stub strategy for validates_uniqueness_of
Hi,
I''m a bit stuck with mocking a unit test of a join model with regards to a
validates_uniqueness_of clause.
I have
class Book < AR:B
has_many :clippings
various validates_presence_of etc
end
class Clip < AR:B
has_many :clippings
various validates_presence_of etc
end
class Clipping < AR:B
belongs_to :book
belongs_to :clip
validates_uniqueness_of :clip_id,
2006 Jan 04
4
many to many link table compound primary key explosion
Hi,
I have a many-to-many relationship between two tables, questions and
answers. My MySQL schema for the link table creates a primary key from
the two fields to prevent duplicate records. When I add the same answer
to the same question more than once, rails attempts to create a
duplicate record and explodes with a MySQL error:
MysqlError: Duplicate entry ''3-3'' for key 1:
2006 May 10
7
has_many :through scope on join attribute
Hi
I have a has_many :through. It''s a basic mapping of
Project
id
....
User
id
....
TeamMembers
project_id
user_id
role
What I would like to do is have different roles so I can have in the project
model
has_many :core_members, :through => :team_members, :source => :user
but I would like to limit this to only those with the "core" role in the
team members table for
2009 May 09
4
Generating a "conditional time" variable
Hi everyone,
Please forgive me if my question is simple and my code terrible, I'm new to
R. I am not looking for a ready-made answer, but I would really appreciate
it if someone could share conceptual hints for programming, or point me
toward an R function/package that could speed up my processing time.
Thanks a lot for your help!
##
My dataframe includes the variables 'year',
2010 Aug 02
7
Complex associations
I am working on a project that has some complex table associations,
and I am having a hard time declaring this association in a Model, and
fear it can''t be done.
Here is an example of my issue...
class StoreType < ActiveRecord::Base; end
class Store < ActiveRecord::Base; end
class Department < ActiveRecord::Base; end
class Product < ActiveRecord::Base; end
A StoreType has
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 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 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
2010 Jan 22
11
Finding out where a variable is defined
I''m looking at code in a project. I have no clue what is being passed
into the resource parameter:
def read_authorized?(resource)
if resource.respond_to? :user_read_authorized?
resource.user_read_authorized? current_user
else
true
end
end
Is there any kind of debugging feature I can run to see what gets passed
into resource in this specific
2020 Jun 05
3
It seems to have bug for @group to set in valid or invalid conf
Hi all,
I am using samba 4.10.7 and it seems to have bug for using @group in valid
or invalid conf (?). And i can't find fixed patch in later release. I
describe this issue detail below:
1. Firstly, there is my samba conf below (Add @d_group in "invalid users"):
(smb_share.conf)
[f1]
path = /home/f1
write list = "admin" "@Administrator_Group"
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
2006 Apr 17
3
model.models.models or model.models.find(:first).models
I the following three models which all have has_and_belongs_to_many
# User <-> UserGroup <-> Permissions
class UserGroup < ActiveRecord::Base
has_and_belongs_to_many :users, :join_table => "user_usergroup_join"
has_and_belongs_to_many :permissions, :join_table =>
"usergroup_permission_join", :uniq => true
end
I can do this:
permissions =
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
2010 Mar 09
3
undefined method join for STRING error
Hey all,
I was converting a haml file to erb and when finished, I ran the app
and got this error message:
NoMethodError in Students#student_fail
Showing app/views/students/student_fail.erb where line #40 raised:
undefined method `join'' for #<String:0x105a5e0c8>
Extracted source (around line #40):
37:
38: <% fields << render(:partial =>
2012 Sep 08
4
dash symbol
In the example below, what is the dash doing between the class
attribute and array:
(field_helpers -
[:label, :check_box, :radio_button, :fields_for, :hidden_field, :file_field]).each
do |selector|
--
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