Displaying 20 results from an estimated 50000 matches similar to: "validates_uniqueness_of serialize"
2010 Aug 28
1
validates_uniqueness_of missing in rails 3.0 rc2?
Has anybody noticed validates_uniqueness_of missing in rails 3.0 rc2? I''m not sure if this is a bug or I''m just doing something wrong.
Here''s what I''m doing.
Class 1:
class Title < ActiveRecord::Base
validates_length_of :language, :is => 3
validates_uniqueness_of :language, :scope => :book_id
validate :language,
2011 Sep 28
1
serialize/unserialize vector improvement
Hi folks,
I've attached a patch to the svn trunk that improves the performance
of the serialize/unserialize interface for vector types. The current
implementation: a) invokes the R_XDREncode operation for each element
of the vector type, and b) uses a switch statement to determine the
stream type for each element of the vector type. I've added
R_XDREncodeVector/R_XDRDecodeVector functions
2006 Feb 08
1
corruption of data with serialize(ascii=TRUE)
I noticed the following peculiarity with `serialize()' when `ascii = TRUE' is
used. In today's (svn r37299) R-devel, I get
> set.seed(10)
> x <- rnorm(10)
>
> a <- serialize(x, con = NULL, ascii = TRUE)
> b <- unserialize(a)
>
> identical(x, b) ## FALSE
[1] FALSE
> x - b
[1] -3.469447e-18 2.775558e-17 -4.440892e-16 0.000000e+00
2013 Jul 15
2
Serialize data.frame to database
Dear R-Users,
I need a very fast and reliable database solution so I try to serialize a data.frame (to binary data) and to store this data to an SQLite database.
This is what I tried to do:
library(RSQLite)
con <- dbDriver("SQLite")
db <- dbConnect(con, "test")
dbSendQuery(db, 'CREATE TABLE frames("simID" INT, "data" BLOB)')
data.bin <-
2007 Nov 08
1
validates_uniqueness_of with conditions
Hello
I have a user table in my db.
A user has a status field, status is an INT an can be between 1-5.
When a new user sign up I want to use "validates_uniqueness_of :login"
in user model.
But I don''t want to validate the new user against users with status ==
5.
Can I do this with some :if or :conditions?
(I prefer not to use my own validate method)
--
Posted via
2006 Sep 11
0
validates_uniqueness_of :number by the year in a DateTime column
Hello all,
I have a class Ticket < ActiveRecord::Base which has a property called
:number and a property called :samples_date.
a ticket number has to be unique over the same year. the year is given
by the property called :samples_date
I''m trying to validate the uniqueness of :number based on the year from
the :samples_date property.
i would like to specify the condition somehow in
2011 Dec 06
1
unserialize and eager execution
Hi,
While debugging a network server I'm developing I noticed something unusual
- call to unserialize() resulted in
an error about loading a namespace.
I was a bit taken back by this - why should unserializing an object cause a
namespace lookup?
Are there any other side-effects of unserialize() that I should be cautious
about? I've been
digging through the R_Unserialize() call, I
2006 Feb 07
2
validates_uniqueness_of case Sensitive
Is there a option to make validates_uniqueness_of Case Sensitive, if so
what is it, if not then how to do it without writing my own function.
Regards
Suraj
2009 Oct 13
0
Re: How can I parse encoded and serialized XML with REXML?
On Sep 24, 2:14 pm, Andy <andym...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> I''ve getting data like this:
>
> <![CDATA[a:1:{i:0;s:6:"Sometext";}]]>
>
> I know in PHP I can unserialize and decode, but I''m not sure the best
> way to do it in Rails.
>
> I''m already parsing the XML using REXML so I''m
2009 Jun 17
2
validates_uniqueness_of fails on STI in Rails 2.3.2
I''ve got something like this:
class Position < ActiveRecord::Base
end
class CartItem < Position
validates_uniqueness_of :product_id
end
When I try to save CartItem I get this error:
ArgumentError: wrong number of arguments (1 for 2)
from
/home/joaz/.gem/ruby/1.8/gems/activerecord-2.3.2/lib/active_record/validations.rb:758:in
`exists?''
from
2008 Jan 26
1
validates_uniqueness_of customization
Hey,
I have a simple web app where I would like users to sign up with a
maximum of two accounts per email address. What would be the rails way
of accomplishing this. Is there anyway of modifying
validates_uniqueness_of to perform the proper validations?
Thanks
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you
2009 Apr 21
2
validates_uniqueness_of
hello all,
i am new to RoR programming and am struck with the functional test whole
checking for uniqeness of carriers. If it is not unique,the the bin
shudn''t be created.Can someone help me in correcting my code.
def test_create_failure_cycle_unique
begin
num_bins = Bin.count
post :create, {:bin => { :carrier => carriers(:A), :cycle =>
cycles(:one), :name =>
2018 Nov 08
0
error unserializing ascii format (v2 or v3)
I see this on MacOS as well, so likely not platform dependent.
A little more diddling to try to narrow it down:
> unserialize(serialize(as.raw(1), NULL, version=2, ascii=TRUE))
[1] 30
> unserialize(serialize(list(as.raw(1)), NULL, version=2, ascii=TRUE))
[[1]]
[1] 30
> unserialize(serialize(list(raw=as.raw(1)), NULL, version=2, ascii=TRUE))
Error in unserialize(serialize(list(raw =
2007 Jul 30
3
validates_uniqueness_of doesn't work if value tested is numeric and column is string
Hello all,
I am working through the depot example in the rails book. If I add a
validates_uniqueness_of to a string column in the model, and then try
to create a record with a number in this string column I get an SQL
error. Looks like the SQL generated to test for uniqueness does not
quote the value if it''s numeric even though it''s comparing against a
varchar column. It does
2008 Sep 19
0
validates_uniqueness_of: passing a method to :scope
I was wondering if anybody knows an easy way to pass a method name as
the scope option to a validates_uniqueness_of validation on a AR model?
For example, I have nested models a bit like:
class Survey
has_many :areas
end
class Area
belongs_to :survey
has_many :questions, :order => ''position''
validates_uniqueness_of :position, :scope => : survey_id
end
class
2018 Nov 07
2
error unserializing ascii format (v2 or v3)
I ran into an interesting error unserializing a file created with
ascii=TRUE:
R 3.5.1 (Windows or Linux):
> unserialize(serialize(list(raw=as.raw(c(39,41))), NULL, version=2,
ascii=TRUE))
Error in unserialize(serialize(list(raw = as.raw(c(39, 41))), NULL,
version = 2, :
ReadItem: unknown type 29, perhaps written by later version of R
The same error happens when the
2006 May 10
4
validates_uniqueness_of and create atomicity
Hi folks,
I have a question regarding validates_uniqueness_of, and similar
before-filter-like events attempting to guarantee some DB state prior
to modification.
>From my reading of ActiveRecord, validate_uniqueness_of appears to
cause a SELECT on the underlying table attempting to ensure that a
record with ID(s) specified in the validates_uniqueness_of statement
is not already present, prior
2006 Jul 09
2
serialized DateTime objects returning as Time objects
I have a database field called dates in which I am trying to serialize an
array of DateTime objects. When I unserialize them, they are coming back
in as Time objects. I know this, because I am getting errors that say
"comparison between Time and DateTime failed.
Why is this happening? Is there a way to prevent it??
Thanks Shelby
-------------- next part --------------
An HTML attachment
2006 May 10
1
Validates_uniqueness_of multiple field combo?
Hello,
I am new to Ruby on rails and this is therefore probably trivial. Lets
say I have 3 tables - users[id,name, age, ...],
interests[id,name,description, ...], and finally a table
user_interests[id,user_id,interest_id] to link a user to a set of
interests. Now there is no problem to put validates_uniqueness_of :name
in the user-model to ensure that I only have one Lenny, but how do I
2009 Jun 26
0
validates_uniqueness_of and MySQL enum type
I tried to check validates_uniqueness_of for a MySql enum type column
with a scope given, like this:
validates_uniqueness_of :phone_type, :scope => :user_id
And It didn''t work. When I check the SQL statement for doing this
validation, it is like this:
SELECT `phone_numbers`.id FROM `phone_numbers` WHERE
(`phone_numbers`.`phone_type` = BINARY '''' AND