I have a few more basic questions about Ruby on Rails.
1) When I call time.now, I get this result: 2011-06-21 19:11:00.518140
The time/date-notation is fine for me, but what is that .518140? Is there an easy way to remove this?
2) It seems my server time is also incorrect (it’s not 19:11 right now). I’m using WEBrick; where can I change the time?
3) I’m using a basic authentication system with this code (from the RoR tutorials):
def authenticate
authenticate_or_request_with_http_basic do |user_name, password|
user_name == 'admin' && password = 'admin'
end
end
It works fine, but when I enter an incorrect password, I get a white page with the text HTTP Basic: Access denied. Is there a way to change this error page to something more user-friendly?
Thank you!
1. That would be microseconds. Try
Time.now.to_s(:db):dbis defined as"%Y-%m-%d %H:%M:%S"which you can use without Rails ActiveSupport like this2. That depends on what OS you are running.