Displaying 13 results from an estimated 13 matches similar to: "DRY validation"
2009 May 25
1
Help --- My phone number field saves blank
I have a phone field in my table.
But in my form i have two text boxes to get the phone number and the
country code like below
Enter country code ----- Enter phone code ------
In my table i have to save the phone code field after joining the above
values with "-" symbol.
Example => 0225-25874255
I dont have table field for country_code .
So i created like below
attr_accessor
2007 Mar 20
1
Ticket 6953: Support Method Not Allowed Responses
Hi,
I was wondering if someone wouldn''t mind looking at ticket 6953
and committing it if everything looks ok:
http://dev.rubyonrails.org/ticket/6953
This patch properly handles setting the Allow header and the
proper status code when an HTTP method is used that a resource
doesn''t support or understand.
--
Thanks,
Dan
2006 May 23
11
putting the schema in the model files
THE SCHEMA IN THE MODEL
a small write up on ''putting the schema in the model''
This is a write up on an issue best covered in a mailing list thread
of Januari 2006 (see the links in the text), I repost it because I
think it deserves a place on the agenda.
== Why? ==
I was switching back and forward between the model files and the
schema.rb -- off course I have
2006 May 31
0
validates_format error
How does validate work? Is the file uploaded before the format is
checked? I tried uploading a pdf and it crashed the WEBrick. Out
putting this over and over:
**** Warning: Fonts with Subtype = /TrueType should be embedded.
But BookmanOldStyle is not embedded.
Surely the file should have been rejected before it is even uploaded?
Model:
class Image < ActiveRecord::Base
belongs_to :user
2006 May 09
0
Mongrel Pre-Release Bravery
Hi Everyone,
Another note that there''s a pre-release available for non-win32
platforms that I''d like people to test out. As usual you can install it
with:
gem install daemons (if you don''t have this)
gem install mongrel --source=http://mongrel.rubyforge.org/releases/
This release adds some fantastic file management gear from why the lucky
stiff and Dan Kubb.
2006 May 11
5
Mongrel 0.3.13 Pre-Release -- Out of Hibernation
Hello Mongrel Fans,
After about a Month of busy work, bad computers, moving half my house
across the country, and other dramas, I''m finally pushing out the next
release of Mongrel.
This pre-release has lots of little goodies and the start of some
documentation that should get everyone primed for the big "Mongrel 0.4
Enterprisey Edition 1.2" coming real soon now.
INSTALLING
2006 Apr 22
0
Remove validation for a property
Hi
Does anyone here know a way who I could remove the validation for a
model''s property? For example, I would like to have in one file:
class A < ActiveRecord::Base
validates_uniqueness :title
end
And in another file I want to override or rather remove the validation:
class A < ActiveRecord::Base
# somehow stop validating :title for uniqueness
end
The
2006 May 14
0
[UPDATE] Mongrel 0.3.13 Pre-Release -- Conditional Responses, Better Parsing
Hi Folks,
As you can tell we''re getting closer to the 0.3.13 release being
official. There''s a new pre-release available for non-win32 users:
gem install mongrel --source=http://mongrel.rubyforge.org/releases/
Which has the following fixes and enhancements:
* Rewritten internal HTTP processing to protect against trickle
attacks. This means that a client can send one byte
2006 Aug 08
0
0.3.13.4 Pre-Release -- Almost Ready
Hi folks,
I just put a pre-release of Mongrel up for people to try. You can
install it with:
gem install mongrel --source=http://mongrel.rubyforge.org/releases/
And try out your application and confirm the stuff works.
USE RFUZZ AND RUBY
If you find a bug, I''d appreciate it if you can go grab RFuzz (or use
net/http) and work up a little bit of Ruby that demonstrates the bug.
If
2005 Jul 26
3
Generating unique random tokens for ActiveRecord objects
I have an ActiveRecord subclass that needs to generate a random (hard
to guess) token for each record in its corresponding table. Currently
I''m doing something like this:
def before_create
self[''token''] = random_value
while self.class.find_by_token(self[''token''])
self[''token''] = random_value
2006 Apr 22
3
How to use Rails and REST
Hi,
I just wrote an article on how to easily create a REST API for
Ruby on Rails applications:
http://www.xml.com/pub/a/2006/04/19/rest-on-rails.html
It describes how to create everything from the ground up and includes
information on testing your API too.
--
Thanks,
Dan Kubb
2007 Jan 01
5
Validations based on associations
My model is very simple, it''s mostly just a join table that represents
which tournaments a user has registered for.
class Registration < ActiveRecord::Base
belongs_to :user
belongs_to :tournament
validates_presence_of :user_id, :tournament_id
validates_uniqueness_of :user_id, :scope => :tournament_id
end
the validates_uniqueness checks to make sure there''s no
2006 Jan 15
0
How to Validate Inherintly?
Very often, I''d like to know if an object is .valid? inherently - that
is, if it meets all the validations that are run on it by itself, but I
don''t care if one of the fields is not unique.
What''s the best way to determine this - that is, to run all the
validations except the validates_uniquness ones?
(A common use case is when importing data - it''s