Displaying 20 results from an estimated 600 matches similar to: "Spec for validation plugin"
2006 Aug 01
0
Custom Autocomplete Field - Making a field lowercase
I''m trying to humanize() the results that appear in the autocomplet drop
down list.
First i customised the controller.
In the render line on the controller it is saying "i want to use locality on
each of the @items".
So locality is what i want to humanize".
My ideas so far is to:
Customise the PostCode object so that when auto_complete_result trys to call
2018 May 10
2
readLines() behaves differently for gzfile connection
When I read a .gz file with readLines() in 3.4.3, it returns text (and a
warning). In 3.5.0, it gives a warning, but no text. Is this expected
behavior or a bug?
3.4.3:
> source_file = "1k_annotation.gz"
> readfile_con <- gzfile(source_file, "r")
> readLines(readfile_con, n = 5)
[1] "#chr\tpos\tref\talt\t
<truncated output here>
Warning message:
In
2013 Apr 05
3
Fwd: rsync 3.0.9 partial file left after CTRL-C WITHOUT using --partial
Hi folks,
man page says "By default, rsync will delete any partially transferred file
if the transfer is interrupted"
I have (reproducible) a partial file left, if I do CTRL-C
source-dir: mounted LVM XFS
dest-dir: see source-dir
Ubuntu 12.04.1 (LTS)
kernel 3.2.0-39-generic
command:
rsync -a
2018 May 10
1
readLines() behaves differently for gzfile connection
You bet - it's available on github at
https://github.com/UW-GAC/wgsaparsr/blob/master/tests/testthat/1k_annotation.gz
-Ben
On Thu, May 10, 2018 at 4:17 PM, Michael Lawrence <lawrence.michael at gene.com
> wrote:
> Would it be possible to get that file or a representative subset of it
> somewhere so that I can reproduce this?
>
> Thanks,
> Michael
>
> On Thu, May
2005 Aug 10
5
validates_format_of on an optional field using :if
Hi there,
I''ve got the following in my model:
validates_format_of :postcode,
:with => /^([a-zA-Z]{1,2}[0-9]{1,2} [0-9]{1}[a-zA-Z]{2})$/,
:message => "is not valid",
:if => :postcode
... but it''s not working - it always insists on validation, even if postcode
is empty. Basically, the postcode field is optional, but if it''s filled in, I
want to
2006 May 18
3
Google Map
Used a great howto @
http://iamrice.org/articles/2005/12/09/using-google-maps-in-the-uk-with-rails
for using google maps on uk sites. Just having one issue I can''t seem
to work out how to draw the postcode from my table I keep getting hit by
method errors.
The controller is
require ''postcode_2_latlong''
postcode = Postcode.new("TN22 2LG")
# I want this to
2002 Apr 16
2
Can rsync update files in place?
I've just subscribed, but a search of the archive doesn't indicate this
has been handled before...
Is there a way to get rsync to not create a new file while transferring
and then rename it, but to instead update the existing file in place,
i.e. simply write those blocks that have been updated and leave the rest
alone?
That would be ideal for what I wanted rsync for, namely updating
2006 Jan 31
11
ez_where plugin updated features.
Friends-
I wanted to let people know that there is a new experimental release
of this plugin. I would love feedback on syntax and features. There
is now a full test suite with fixtures that covers all the available
syntax. Look at the test suite for more syntax possibilities. There
have been many additions since my last release. Fabien Atelier has
been working on this with me and has
2006 Feb 28
1
Wrong id after join!
The Problem
-----------
After using a join in my find the id attributes set in my Entity objects
are wrong! It is setting the Entity id to the value from Postcode id!
The Code
--------
entities = Entity.find(:all,
:conditions => [...omited...],
:joins => "as e inner join postcodes as pc on
substring_index(e.postcode,'' '', 1) =
2008 Jul 29
1
can't crop images using ImageMagick
I''m using Attachment_Fu to save several thumbnails of a photo
(resizing with ImageMagick)
But when I try to crop them, nothing seems to happen to the file I
want to drop and no error messages. I check the file timestamp of the
thumbnail I want to crop and it looks updated. What''s strange is that
ALL the other thumbnails and the original image''s file timestamps are
2006 Feb 27
6
One to Many example... please!
Hi,
I am pulling my hair out trying to work out how to put together what
should be a simple app in rails. The app is to CV''s so I have a table of
CV''s and each CV can have multiple skills. Skills are in a 2nd table
below;
CREATE TABLE cvs(
id INT not null AUTO_INCREMENT PRIMARY KEY,
first_name VARCHAR(30) not null,
family_name VARCHAR(30) not null,
email
2010 Aug 11
6
rspec2 not working with shoulda
I am using rails edge. I am using gem "rspec-rails", "= 2.0.0.beta.
19" .
I have following code at spec/models/user_spec.rb
require ''spec_helper''
describe User do
it { should validate_presence_of(:email) }
it { should validate_presence_of(:name) }
end
Here is my gemfile
group :development, :test do
gem ''factory_girl_rails'',
2006 May 03
10
get Addresses and house numbers from Post Code?
Hi,
does anyone know a way to get the address and a list of house numbers
from a Post Code? Is their an online web service that will do this?
I''m creating an app for a chinese take-away and this functionality is
important. What do you think is the best way of achieving this? for UK
post codes.
Thanks
Chris
--
Posted via http://www.ruby-forum.com/.
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
2009 Feb 02
12
[RSpec] rcov and/or rexml bug?
Hi,
Running: Ruby 1.8.7 p72, RSpec 1.1.12 and rcov 0.8.1.2.0, I get the
following error message with $ rake spec:rcov
--
/usr/local/ruby1.8.7//lib/ruby/1.8/rexml/formatters/pretty.rb:131:in
`[]'': no implicit conversion from nil to integer (TypeError)
from
/usr/local/ruby1.8.7//lib/ruby/1.8/rexml/formatters/pretty.rb:131:in
`wrap''
from
2008 Jan 23
6
sharing specs in a subclass
Hi
I''ve spec''d a class and they pass.
Now I''d like to assure that any subclass of this class also passes
the same specs.
Any suggestions for a clever way to handle this?
I''d prefer to keep the existing specs as is (eg instead of moving
everything into shared behaviors, or doing something to all the
''describe'' lines)
thanks
linoj
2006 May 30
6
Reuse Partials
Hi all,
This is my first official post as RoR developer, so here it is.
I''ve got a partial for a Address (Postcode, Address, City, ...). I want
to use this partial multiple times on the same form? So I want to fill
in multiple addresses and insert them individualy. How do I go about
doing this?
Kind Regards,
Eugene Louw
--
Posted via http://www.ruby-forum.com/.
2008 Sep 22
1
Ccreating methods on the fly / counting distinct field values
Hi,
I''m pretty new to ruby and rails, so apologies if this has been covered
before (I couldn''t find a thread on it).
I want to retrieve a count of records held in the DB for every distinct
value of an attribute.
E.g. given a class Address with a postcode field, I would like to retrieve
an array of ValueCount objects. The ValueCount object would hold the value
retrieved from
2008 Mar 05
3
regex sulotion for seperating number and string
I have strings contain postcode and letters, some seperated with blank, some
with comma, and some hasn't seperated. eg, "2324gz" "2567 HK" "3741,BF"
I want to seperate the number and letters into two new variables.
I know this should be quite basic question, but searched on regex syntax and
that seems a bit scarey to me, any one can shot me a quick solution
2007 Nov 09
9
fixture_file_upload and edge rspec?
Hi all,
I had some specs that were using fixture_file_upload that were
passing just fine. Then I froze edge rails to get some 2.0
functionality, then a I upgraded to trunk rspec to deal with
uninitialized constant ActionView::Helpers::JavaScriptMacrosHelper
After a couple other of tribulations, I have now gotten down to just
a couple of not passing specs, all using the fixture_file_upload.