lib/ratchetio/rails/controller_methods.rb in ratchetio-0.3.2 vs lib/ratchetio/rails/controller_methods.rb in ratchetio-0.4.0
- old
+ new
@@ -14,20 +14,20 @@
:method => request.method,
}
end
def ratchetio_person_data
- user = begin current_user rescue current_member end
+ user = send(Ratchetio.configuration.person_method)
# 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
+ if user
+ {
+ :id => begin user.send(Ratchetio.configuration.person_id_method) rescue nil end,
+ :username => begin user.send(Ratchetio.configuration.person_username_method) rescue nil end,
+ :email => begin user.send(Ratchetio.configuration.person_email_method) rescue nil end
+ }
+ else
+ {}
+ end
rescue NoMethodError, NameError
{}
end
private