I've got the following Model for Accounts
require 'net/http'require 'uri'require 'date'class Account < ActiveRecord::Basevalidates_presence_of :username, :password, :on => :updatevalidate :valid_expiry_date, :on => :update def valid_expiry_date reply = Net::HTTP.get URI.parse("http://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=getaccountdetails_v1&type=prem&login=" + username +"&password=" + password) account = Time.at(reply[80..90].to_i) if (Time.now + 2419200) <= account return true else return false errors.add_to_base("Sorry this account isn't valid") end endend
I know the code works in a ruby.rb file and will return true or false, however I seem to be having rather a lot of difficultly trying to translate this code into an actual validation, any help would be much appreciated. Thanks
Its also defiantly at least connecting to the website as my firewall asked me if the Terminal was allowed to access it.
At the moment not only is it displaying no errors it's actually letting anything through and saving it.