Sha256: c16f2290100fb2f39dcee7383a3846622dbb38cbc8c3ee7145c26804c65fcf0a

Contents?: true

Size: 876 Bytes

Versions: 2

Compression:

Stored size: 876 Bytes

Contents

class User < Volt::User
  # login_field is set to :email by default and can be changed to :username
  # in config/app.rb
  field login_field
  field :name

  validate login_field, unique: true, length: 8
  validate :email, email: true

  unless RUBY_PLATFORM == "opal"
  	Volt.current_app.on("user_connect") do |user_id|
  		begin
  			Volt.current_app.store.users.where(id: user_id).first.sync._event_triggered = "user_connect"
  		rescue
  			#we rescue as this callback will also get called from the SocketConnectionHandler specs (and will fail)
  		end
  	end

  	Volt.current_app.on("user_disconnect") do |user_id|
  		begin
  			Volt.current_app.store.users.where(id: user_id).first.sync._event_triggered = "user_disconnect"
  		rescue
  			#we rescue as this callback will also get called from the SocketConnectionHandler specs (and will fail)
  		end
  	end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
volt-0.9.6.pre2 spec/apps/kitchen_sink/app/main/models/user.rb
volt-0.9.6.pre1 spec/apps/kitchen_sink/app/main/models/user.rb