I am writing an application where users must be at least 13 years to join. My setup is and, and this is my user model:
User.rb
attr_accessible: birthday validates_presence_of Validate birthday: is_certain_age personal def is_certain_age if self.birthday errors.add (: base, 'you need atleast 13.') If self. Birthday & gt; I tried to check the browser in the date, but when I submit the registration form, it posts and the user is making or not making it. . I have no clue why the Unicorn server will not tell me what the parameters like WEBrick will be all I get: 127.0.0.1 - - [22 / June / 2013 11:21:12] ] "Post / User HTTP / 1.1" 200 - 0.3460 For users, my passphrase shows for test failures:
User Failure / Error: This should be {_valid} node method. ERR: `Date 'for Unspecified Method 2000: Fixation Note:
Use The user should use valid user age failure / error: (should ensure this): (birthdays) .in_range (13..150)} was not expected to include errors "is not included in the list" .... ... when the birthday is set to 12, the error is found: What did I do?
What do you want:
errors.add (: base , 'You must have at least 13'). Birthday & gt; Date.Today - 13.years You were comparing a FixNum of DateTime ( self.birthday ) code> ( 2000 , the result of date.today.year - 13 ), while in my code is above: dateToday - 13. year < / Code>, the result is also a date time.
No comments:
Post a Comment