Displaying 20 results from an estimated 226 matches for "downcasing".
2006 Jan 09
3
Pagination :conditions not working - MySQL v. PostgreSQL, Rails abstraction v. embedded SQL
Hi everyone,
I have this code:
@person_pages, @people = paginate :person, :per_page => 20,
:conditions => [ "username LIKE ? OR first_name LIKE ? OR
last_name LIKE ? OR preferred_name LIKE ?",
"%" + params[:q].downcase + "%",
"%" + params[:q].downcase + "%",
2009 Aug 28
0
string downcase or how to use downcase an hostname in puppet?
Hi there.
I am trying to fix hostnames in our Redhat distributions.
Some of our server has some hostname un uppercase, and I need to change them
into lowercase because people that use the server rather like lowercase
hostnames...
I did some basic work :
Template :
$ cat /var/puppet/templates/rh-network.erb
# WARNING this file is autogenered by puppet. Any change there will
# be
2006 May 02
4
useful bit of code (hopefully)
Hi,
I often find myself using bits of code like this inside ActiveRecord,
perhaps it''s useful for others, or others can improve on it:
###########
# fix user input before validating it
before_validation :sanitize_input
# santize input before actual validation is called
# this uses the little methods defined below
def sanitize_input
trim %w(adres postcode woonplaats email naam
2010 Nov 10
0
Problem with case statement and mb_chars in Ruby-1.9.2
RoR-3.0.1
I have this case statement:
case n.hll_normalize
when "common name"
@my_correspondent.correspondent_common_name = s
when "legal name"
. . .
else
raise ArgumentError, "#{n} attribute is not provided for."
end
hll_normalize is defined as:
def hll_normalise
strip.squeeze(" ").mb_chars.downcase
end
I
2005 Nov 30
3
Downcasing Legacy Table Column Names
I''m looking for the simplest way to *automatically* downcase the
attribute names of Models mapped to legacy tables that use upper
case. eg:
class Workorder < ActiveRecord::Base
set_table_name "WORKORDER"
end
which has "NAME" as an attribute can use "name" as an attribute.
currently:
workorder = Workorder.find(1)
workorder.NAME # =>
2006 Sep 23
8
svn problems
I can consistently segfault the 0.10.4 gem, so I''m trying to get the
subversion version working with hopes towards tracking the problem down.
I have a fresh SVN checkout but:
a) the version (in ferret.rb) claims to be 0.9.6; and
b) Ferret::Index::FieldInfos and a couple other classes are missing at
run time. It looks like this is because they''re not exported in the C
2006 Sep 05
4
No matches
The following script creates a search index and then searches it. I get
no results? Where am I going wrong?
Thanks.
-----------BEGIN SCRIPT----------------
require ''rubygems''
require ''ferret''
include Ferret
path = ''/tmp/myindex''
field_infos = Ferret::Index::FieldInfos.new()
field_infos.add_field(:name, :store => :yes, :index => :yes)
2006 Aug 12
0
BUG in actionpack , error evaluating nil.downcase ?
hi all,
I try to deploy on my host (site5) on I have this error with
dispatch.fcgi start !
( RAILS_GEM_VERSION = ''1.1.6'' )
You have a nil object when you didn''t expect it!
The error occured while evaluating nil.downcase
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/request.rb:18:in
`method''
any idea ?
arnaud
2006 Mar 13
0
Getting AR to downcase table and column names
I''m looking for the cleanest way to force the Rails framework to use a
lower-case version of the table and column names in a database when
creating records.
I need this for a Rails application that displays the status of an
existing backup system. The backup system (Bacula; Nice backup
system, BTW) can use either Postgres or Mysql as its database engine.
Unfortunately, the table and
2013 Sep 15
1
Why does Rails convert scopes to downcase
I found a strange behavior in Rails 4 with scopes when I use postgres.
I have a Object with saleStartDate and saleEndDate attributes.
scope :active, -> { where(isActivate: true) }
> scope :activeDate, -> { active.where("? BETWEEN saleStartDate AND
> saleEndDate", Date.today)}
When I use sqlite, all works when I want to get the object with the
activeDate scope.
When
2012 Sep 20
4
access controller's object attributes in view page
Hi,
I am new to ROR and learning it. In my controller I have an admins
record and I am passing that admin object to the admin''s view page to
get the name of the admin. But when I try to access the name it is
showing error as "undefined method `name'' for :current_admin:Symbol"..
Please help..
Please find my code below
Sessions Controller
def create
2006 Jul 15
2
FieldQuery not returning anything
Hey ..
The QueryParser RDoc page explains to me on how to search for a specific
value in a specific field. This is not working the way i thought it
should be, what am i doing wrong? Here''s an example ..
I''m storing model data in the index like this:
doc << Field.new( "object_id", object.id, Field::Store::YES)
doc << Field.new( "type",
2005 May 23
1
has_and_belongs_to_many dual insert error ?
Hi !
(See references at the end)
I have a slight problem. Whenever I save one of my domain models, which
contains an has_and_belongs_to_many relationship with another one, the
relationships are doubled.
My domain is a series of pictures, where each picture can be tagged with
one or more words. So, a picture of my dog could be tagged "Jordy, Dog,
Dog 2005", for example.
In my
2006 Dec 27
10
Mixing html tags and Ruby blocks
I''m trying to get the following idea to work:
<%= @column_names.each { |t| <td> t.downcase </td> <td>
@listing.send(t.downcase)</td> } %>
Essentially I want to display a form that has a left and right TD, with
the left TD being a column name and the right TD being the column data.
If there''s a better way (the Rails way ?), I''m all ears
2007 Jan 07
6
0.22.0 Errata: Facts are not downcased
I forgot to mention this in my announcement yesterday.
Puppet facts are no longer downcased in the language, and string
comparisons now default to being case-insensitive. Where your
operating system might previously have been ''solaris'' or ''debian'', it
is now ''Solaris'' or ''Debian''. However, you can still do comparisons
2007 Nov 02
11
xrcise tutorial, undefined method ''upper_bt''
Hi
I''m trying to follow the tutorial on xrcise at
http://wxruby.rubyforge.org/wiki/wiki.pl?UsingXRCise
But I keep getting the following error when I try to run the example;
tutorial.rb:21:in `initialize'': undefined method ''upper_bt'' for
#<CaseChangeFrame:0x2d610f8> (NoMethodError)
from tutorial.rb:28:in `new''
from
2007 Aug 26
2
Multi-word query searching across columns
I''m trying to implement a basic name search on a People table with
separate first_name and last_name columns. I am using the
will_paginate plugin and have the following search method in the
model:
def self.search(search, page)
paginate :page => page,
:conditions => ["lower(last_name) like ? or
lower(first_name) like ?",
2006 Apr 20
7
Rails + postgres case insensitive searches.
Hello all
I am wondering how rails handles case sensitivity in databases. If I
do a Person.find_all_by_name("tim") in mysql I would expect to get
tim, TIm, and Tim. Do I only get tim in postgres?
How do other people deal with this? Do you resort to find_by_sql for
all your postgres queries to get case insensitive results?
2006 May 30
3
match operator in find
Greetings!
Is there some special syntax required to use the match operator (=~) in a find operation? Or is it not possible? I''ve got some data items from an external source that could be capitalized or not. So right now I''m stuck with doing:
Item.find(:first,
:conditions => ["name = ? or name =?", Potatoes, potatoes])
I''d prefer to do:
2010 Dec 30
4
perl code to remove newlines
Given an HTML file which looks like this:
--------- begin snippet ---------
<HTML
><HEAD
><TITLE
>We've Lied to You…</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="Maximum RPM"
HREF="index.html"><LINK
REL="UP"