Hi all…i am newb for rails as well as ruby
I have Column called Description In My Table.
I would Like to Validate That Description Column.
That is It Should Only Contain Texts Not Images.
What Do I DO With Using Regular Expressions?
But you should read /Agile Web D. with Rails/, by the Daves,
before
asking any questions there.
I have Column called Description In My Table.
I would Like to Validate That Description Column.
That is It Should Only Contain Texts Not Images.
Validations are not invariants, they are part of user interaction. How
will your
users put content into the description? If they post it thru a
, it
already is only ASCII (actually UTF-8) text. cannot absorb
rich text
input with pictures.
> What Do I DO With Using Regular Expressions?
Some validation directives accept a regexp, but you need to characterize
what an
"image" would look like in your input before bouncing it. If, for
example, you
allow users to enter raw HTML, and you will mark it up when displaying
it, you
could write a regexp against "<img". But this will fail if the user
wanted a
cleartext "<img" in their message, and it will fail to remove '<object'
and
'
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.