On 24 February 2010 11:12, Andy Jeffries <[email protected]> wrote:
> (well, you could do it with validation on the model)
Isn't that where it would be best?
> You can do this:
> <script type='text/javascript'>
> if ($('#Test').val().length > 5)
> ('#submit').hide();
> }
> </script>
but of course, we all know that relying solely on JS for validation is
a sure method for letting duff data get into your DB (because not
every browser has JS enabled or supported)
By all means, use the JS to enhance the front end; but if you have to
ensure there's no more than a certain amount of associations, you
*have* to check that in the model.
You could also check the params array coming into the controller, and
see what the size is there (unfortunately, I don't have time right
this second to try it out, but if you haven't sorted it yourself
later, re-post for help and I'll have a play)
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.