Sha256: 980d1908fc0bd2e0f707714acc658410bde916b3c3e8cdbf59b25461b79d38c3

Contents?: true

Size: 671 Bytes

Versions: 4

Compression:

Stored size: 671 Bytes

Contents

class AccountBinder < Bowline::Singleton  
  class << self
    # self.collection is a special method
    # Basically it'll update users on the client side
    def index
      self.item = current_account
    end
 
    def destroy
      current_account.destroy
      self.item = nil
    end
  end
  
  # Everything has a js_id which is basically the lowercase classname + _ + self.id
  def highlight
    # Calls $(element).highlight()
    self.element.highlight
  end
  
  # Overrides charge on user
  def charge!
    # calls charge on model (i.e. do sql commit )
    self.item.charge!
    # Now gui stuff
    flash[:notice] = "Successfully charged"
    highlight
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
maccman-bowline-0.1.1 examples/account_binder.rb
maccman-bowline-0.1.2 examples/account_binder.rb
maccman-bowline-0.1.3 examples/account_binder.rb
maccman-bowline-0.1.4 examples/account_binder.rb