lib/ratchetio/rails/controller_methods.rb in ratchetio-0.1.2 vs lib/ratchetio/rails/controller_methods.rb in ratchetio-0.2.0
- old
+ new
@@ -12,9 +12,25 @@
# leaving out POST for now
:method => request.method,
}
end
+ def ratchetio_person_data
+ user = begin current_user rescue current_member end
+ # include id, username, email if non-empty
+ user.attributes.select do |k, v|
+ if v.blank?
+ false
+ elsif ['id', 'username', 'email'].include? k
+ true
+ else
+ false
+ end
+ end.symbolize_keys
+ rescue NoMethodError, NameError
+ {}
+ end
+
private
def ratchetio_request_url
url = "#{request.protocol}#{request.host}"
unless [80, 443].include?(request.port)