| Field | Datetype |
|---|---|
| screen_name | string |
| message | text |
| Field | Datetype |
|---|---|
| username | string |
| password | string |
require 'digest/md5'
before_filter :authenticate, except: [:index, :show]
private
def authenticate
authenticate_or_request_with_http_digest("localhost") do |username|
if user = User.find_by_username(username)
user.password
else
nil
end
end
end
localhost is the realm, which is usually the name of the server.