Displaying 16 results from an estimated 16 matches similar to: "data validation"
2007 May 05
10
have_one and have_present
>Comment By: Luis Lavena (luislavena)
> Date: 2007-05-04 23:37
> describe "An Asset" do
> before(:each) do
> @asset = Asset.new
> end
>
> it { @asset.should have_one(:attachment) }
> it { @asset.should have_present(:something) }
> end
Food for thought on these. I like have_one a lot. It speaks to me as a
Rails developer and I think it speaks to
2008 Mar 02
0
Models are not initialised correctly with ''rake test'' in Merb 0.9.1
I''m using Sequel as my ORM and Test::Unit as my testing framework and
have the following model:
class Item < Sequel::Model
validates do
presence_of( :name, :uuid, :vendor_id, :vendor_reference, :amount,
:currency_code )
uniqueness_of( :uuid )
end
def initialize( *args )
super( *args )
self.uuid = UUID.random_create.to_s
end
end
As you can see I overwrite
2005 Sep 27
2
No Custom Validation
Hi,
Correct me if I am wrong but there doesn''t seem to be an easy way to add
validation outside the pre-built ones (validates_presence_of,
validates_lenght_of, etc.).
Ideally there should be something like:
Class Person < ActiveRecord::Base
validates :my_method, :on => create, :message => ''was not valid''
def my_method(param)
false unless
2006 Feb 04
0
Easy way to force using jlenght and no lenght in validations
I need validates_lenght_of validates lenght of UTF-8 strings and not
just byte counting. Is there easier way than create my own validation
method just validates_jlenght_of?
--
Posted via http://www.ruby-forum.com/.
2007 Jan 09
6
rcov seg fault
Hi
Trying to get rcov going (has been working), but with the following context
and specs it fails.
context ''/account POST with invalid attendee'' do
controller_name :account
setup do
Attendee.stub!(:create!).and_raise(ActiveRecord::RecordInvalid.new(
Attendee.new))
end
specify ''should raise on create'' do
Attendee.should_receive(:create!).with({
2006 Jul 16
0
Problems with validates_lenght_of
I''m building a login system, and I want users to be able to update their
password, first name and last name after signing up. So, when signing up
password can''t be nil, and it must be between 6..20 characters long. However,
on update, the user can choose to leave the password field empty (but fill in
other stuff, like first name) and then I want the User model to not update
2007 Oct 04
12
Rails' abilities fitting?
Hi,
I''m looking at developing a reasonably complex web application, where
most of the complexity actually lays in the database and the queries
I need run on it. Some "classes" or models need to consist of an
assembly of several tables. It would be trivial enough for me to code
these queries in SQL, but as far as I understand Rails is trying to
hide the database as
2008 Mar 14
5
Branching scenarios, GivenScenario and database
I''m trying to use stories to drive some high-level design.
I''ve got some branching scenarios where I want to follow a scenario,
to establish a base situation, and then have different scenarios which
''branch'' out from that state, possibly several levels deep.
I asked a bit about this a few days ago, and David pointed out the
rather undocumented GivenScenario
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,
2016 Nov 14
2
Processed (with 1 error): block 827061 with 828253 828367 828586 828309 828307 828513 812166 828412 828298 828277
Processing commands for control at bugs.debian.org:
> block 827061 with 828253 828367 828586 828309 828307 828513 812166 828412 828298 828277
Bug #827061 [release.debian.org] transition: openssl
827061 was blocked by: 828555 828359 828618 827076 828422 828459 828532 828330 828535 828313 828324 828547 828265 844311 835790 828533 828416 828394 828500 828255 828494 828395 828355 828443 828338
2016 Jan 21
7
Bug#812166: xen: FTBFS with GCC 6: statement is indented as if...
Package: xen
Version: 4.6.0-1
Severity: important
User: debian-gcc at lists.debian.org
Usertags: ftbfs-gcc-6 gcc-6-misleading-indentation
This package fails to build with GCC 6. GCC 6 has not been released
yet, but it's expected that GCC 6 will become the default compiler for
stretch.
Note that only the first error is reported; there might be more. You
can find a snapshot of GCC 6 in
2006 Mar 28
0
Ruby 1.8.4 broke my Rails 1.1
I''ve been running edge_rails on ruby 1.8.2 for a while pretty
successfully. Today, I decided to unfreeze_rails, install the new gem
for 1.1 and then while I was at it, upgrade to Ruby 1.8.4.
I did the whole configure, make, make test, make install.
When I fired up rails, I started getting all sorts of errors:
2006 Mar 30
3
Rails 1.1 hosed my Apache!
Just sharing an experience with you all -- hopefully you take better
precautions than I do. :-)
I have a few sites built with Rails 0.8.3 that were ugpraded to 1.0.
The newer sites are on edge rails. So when I heard 1.1 had come out,
I unfroze my new apps, and installed the new gem for Rails 1.1.
The sites that was operating on edge rails worked just fine.
However, the sites that were working
2006 Feb 14
0
Help with Eager Association
I''ve gotten eager associations to work before, but for some reason
this isn''t working out for me this time. I''ve been scratching my head
but can''t quite figure out the nuances of what works and what doesn''t
work.
I''ve got 3 models: profile, widget_configuration and widgets
profile.rb --
has_many :widget_configurations
2006 Jan 20
11
HABTM relations
Hi,
I have 3 tables with HABTM relation.
USERS -> QUOTE_TO_USER <- QUOTES
Table QUOTE_TO_USER has 3 attributes: quote_id, user_id, component.
I have a form where I can tie multiple users to QUOTE. This is easy one,
thru "user_ids" (@quote[:user_ids] = @params[:quote][:user_ids]).
In this form I have all users and I just check those I want to tie to
this quote, however
2005 Jan 13
1
SCCP questions
Hi!
I have two, not too related questions:
- the probably simpler one: if anyone can help me out using a Cisco
7905G with chan_sccp? I did already managed to get it working with a SIP
image, I'd just like to see it work with this one as well. It's probably
something I screw up with the configuration, as the phone registers,
only I don't get any lines with it, although I have it