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.
Alexander (Guest)
on 2006-02-18 21:03
How would I go about validating against spaces (for urls)
Instead I wish to use dashes.
Luke R. (Guest)
on 2006-02-19 03: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?
Alexander (Guest)
on 2006-02-19 13:08
Luke R. 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'
Richard W. (Guest)
on 2006-02-19 18:37
(Received via mailing list)
Is the url a field in an ActiveRecord object?
Alexander (Guest)
on 2006-02-19 19:06
Richard W. 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.