Displaying 20 results from an estimated 2000 matches similar to: "validates :uniqueness apparently doesn't"
2013 Apr 03
1
validates uniqueness scope allow_blank/allow_nil -> validation error
I have this in a model:
class GenreBadge < ActiveRecord::Base
belongs_to :game, counter_cache: :genre_badges_count, touch: true
belongs_to :genre
validates :game_id, uniqueness: {scope: :genre_id}, allow_blank:
true
end
When I get one existing genre badge
genre_badge = game.genre_badges.first
genre_badge.game_id = nil
genre_badge.save!
It creates an validation exception:
2010 Mar 21
0
Validates uniqueness scope
In a Rails 2.x validation to check if the name of some model is unique
within a some category, I would use:
`validates_uniqueness_of :name, :scope => :category_id`
In Rails 3, this is replaced with:
`validates :name, :uniqueness => true`
However, I can''t seem to find a method of defining the uniqueness''
scope. Am I missing something?
Thanks,
Angelo
--
You received
2013 Jun 25
1
Broken URLs to guides and APIs on rubyonrails.org
This is some feedback for rubyonrails.org. My apologies if this is the
wrong forum to bring this up, but I wasn''t able to find a "Contact us" link
on the site.
As of this writing, if I go to Google and search for "active record
observer validations", the top 2 results are:
http://guides.rubyonrails.org/active_record_validations_callbacks.html
and
2014 Apr 02
1
inconsistent error messages on Mac OS X
Hi All,
I am one of the contributors to the FastR project (
https://bitbucket.org/allr <https://bitbucket.org/allr.>) and I have
encountered an interesting issue when trying to implement vector accesses
within FastR. I am trying to understand what kind of error message should
be generated for the following expression:
x<-1:4; x[[1]]<-NULL; x
In order to determine the error message,
2011 Feb 24
1
Rails 3 save parent model and association if nested attributes validation fails for uniqueness
Hi,
Song
has_and_belongs_to_many :people
accepts_nested_attributes_for :people
Person
validates :uniqueness => true
If person record not present, nested attributes working great! in rails way.
i.e., inserting into songs, people and people_songs table correctly.
I am interested in:-
*If there is person exist, it should skip insertion into people table but
data should be inserted in songs and
2010 Jun 19
1
Is validates_presence_of() deprecated in Rails 3?
Just wondering if validates_presence_of() has been deprecated in
favour of validates(:name, :presence => true) or we can prefer to use
any?
Asking so, since NetBeans 6.9 shows a deprecation warning, however I
can not find any such deprecation message in documentations/code of
Rails 3.0.0.beta4 and on web.
--
You received this message because you are subscribed to the Google Groups "Ruby
2012 Jun 06
1
Default value for case sensitive on uniqueness validator
Hello,
The uniqueness validator was always case sensitive but that seems wrong because we want uniqueness validations to be insensitive in most of the time.
Do not make more sense be insensitive by default and set sensitive only where it should be?
We are migrating a lot of big applications from mysql to postgresql here and we are setting case sensitive to false on **all** uniqueness
2005 Oct 21
4
Validate uniqueness on two columns
I would like to validate the uniqueness of two columns together. I have last
and first names as separate columns. What is the Rails Way to do this?
Thanks,
Jared Nuzzolillo
_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails
2013 Aug 22
1
duplicated log lines in console
my app seems to be running fine in dev mode ( Rails4, Devise, OAuth2 ,
Doorkeeper ) but looking at the console , I can see all log lines
duplicated ....
where should I look for any tricky bug or missing param ?anyway to get more
info on what''s happening ? thanks a lot for feedback
(ruby-2.0.0@rails40)$ rails server -p 4000
=> Booting WEBrick
=> Rails 4.0.0 application starting
2002 Mar 11
2
Obtaining tag-independent track uniqueness?
Hello:
As seen in some of the MP3-oriented P2P programs and audio organizing
tools, the underlying uniqueness of a given mp3 file can be learned (for
the most part) by, for instance, taking a hash of the first 300,000
bytes of the non-id3 tag content of an mp3 file to obtain a content
signature (This hash could then further be paired with the length of the
non tag portion of the entire file for
2012 Oct 24
1
Uniqueness and sql serialize
Hi fellow programmers,
I was looking for how to keep integrity in some financial transactions and
I saw this "This could even happen if you use transactions with the
‘serializable’ isolation level." in the uniqueness page
http://api.rubyonrails.org/classes/ActiveRecord/Validations/ClassMethods.html#method-i-validates_uniqueness_of.
How this is possible with the serializablo
2011 Apr 28
3
difference between validate and validate_on_create
i just ran into a problem with some test, and i am not exactly sure why,
but the difference happened when i changed my model validation from:
validate :custom_validation
to:
validate_on_create :custom_validation
can someone give me any ideas on where in the chain the validation takes
place?
thanks!
--
Posted via http://www.ruby-forum.com/.
2012 Apr 18
1
Re: validates_uniqueness_of question
Hi All,
I am trying write a validation rule where I need to ensure that when a
certain value is updated or created in a particular columns, a number of
other columns columns are unique and that another column does not contain a
certain value.
I have been able to use the validates_uniqueness_of :column_a (to be
updated or inserted) with , :scope =>
[ :column_b , :column_c , :column_d ]
2010 Dec 03
1
email notification
Hi guys,
I have a feature request of email notification on forum. (Just like what
this forum has)
I am wondering if there is a rails plugin that does this.
Any suggestions and ideas are welcome!
Thx in advance.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group,
2011 Jul 26
1
ActiveRecord has_many associations
Given the models Country, State, City and Person as follows.
class Country < ActiveRecord::Base
has_many :states
end
class State < ActiveRecord::Base
belongs_to :country
has_many :cities
end
class City < ActiveRecord::Base
belongs_to :state
has_many :people
end
class Person < ActiveRecord::Base
belongs_to :city
end
Is there any way that doesn''t allow to delete
2013 Mar 25
1
validates presence of foreign key fails in nested form
I''m using accepts_nested_attributes as follows:
class Timesheet < ActiveRecord::Base
attr_accessible :status, :user_id, :start_date, :end_date,
:activities_attributes
has_many :activities, dependent: :destroy
has_many :time_entries, through: :activities
accepts_nested_attributes_for :activities, allow_destroy: true
end
class Activity < ActiveRecord::Base
attr_accessible
2013 Jun 02
16
Ruby 2.0 is running, but Rails 4 doesn't see it.
What am I doing wrong??
****@ubuntu:~/ruby/things_i_bought$ rake db:migrate
Rails 4 prefers to run on Ruby 2.0.
You''re running
ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-linux]
Please upgrade to Ruby 1.9.3 or newer to continue.
****@ubuntu:~/ruby/things_i_bought$ ruby -v
ruby 2.0.0p0 (2013-02-24 revision 39474) [i686-linux]
****@ubuntu:~/ruby/things_i_bought$ rvm
2006 May 04
2
validates* give me problems
Hi All,
I''m newbie to this tool and following some tutorials I''ve came across
with this problem when configuring my webpage:
In Debian/testing, ruby1.8, rails1.1
I create my audio application which connects to a database (mysql) named
audio with tables:
articulos(id,titulo,descripcion,created_on,categoria_id) and
categorias(id,titulo)
after creating and modifying the
2006 Jun 29
0
How to validate uniqueness only if value exists
I''m looking for the best way to use validation to confirm that an
optional field (hostname) is unique only if a value is entered in the
form.
I was originally following the path shown in Agile Web Development with
Rails first edition, page 66, to define the "validate" method, but
didn''t have a clue how to include a uniqueness test there. Right now, I
have the
2012 Mar 14
0
Validating field uniqueness via Ajax call with appropriate message in Rails 3
Hello all,
I am trying to do a Rails + AJAX call validation to check for the
uniqueness of a field, by crawling the back end DB and return an
appropriate message based on the result.
I am on Rails 3.0.11.
Your kind inputs on what could be the best way to tackle this would be
of real help.
Is there a ruby gem / js plugin / jquery plugin that I can make use of?
Any blogs links implementing the