Forum: Ruby on Rails validate against spaces

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
9acb6dd7bd59496bd005c4434a3dd475?d=identicon&s=25 Alexander (Guest)
on 2006-02-18 20:03
How would I go about validating against spaces (for urls)
Instead I wish to use dashes.
1e99128ebac5ca41c91940291d315332?d=identicon&s=25 Luke Redpath (Guest)
on 2006-02-19 02:58
(Received via mailing list)
You might want to clarify your question a bit more if you want a useful
answer.

What data are you trying to validate, and where?
9acb6dd7bd59496bd005c4434a3dd475?d=identicon&s=25 Alexander (Guest)
on 2006-02-19 12:08
Luke Redpath wrote:
> You might want to clarify your question a bit more if you want a useful
> answer.
>
> What data are you trying to validate, and where?

I'd like to validate urls without any spaces:
So this wouldn't be allowed 'new page'
But this would 'new-page'
5d15c6821f3c3054c04b85471824ba7c?d=identicon&s=25 Richard Williams (Guest)
on 2006-02-19 17:37
(Received via mailing list)
Is the url a field in an ActiveRecord object?
9acb6dd7bd59496bd005c4434a3dd475?d=identicon&s=25 Alexander (Guest)
on 2006-02-19 18:06
Richard Williams wrote:
> Is the url a field in an ActiveRecord object?

yes

I was thinking along the lines of
 validates_format_of :url, :with => 'ect'
This topic is locked and can not be replied to.