Click here to Skip to main content
15,887,464 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I am currently doing an assignment with dynamic pages,
I have one dynamic page for rating courses, in which i had to restrict the comment box to 25 characters and also find a way to count the number of words input by the user giving a rating.

I have figured out how to restrict to 25 characters in my comment.rb file but i am completely lost how to capture the user input word count?

I assume its coding needed in my html.erb and controller file?

Thanks

What I have tried:

##code used for my character restriction
validates :comment, :presence => true, :length => {
:maximum => 25,
:too_long => ":Please limit your commentary to a maximum of %{count} characters, thank you."
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900