Class Counter
In: lib/counter.rb
Parent: ActiveRecord::Base

Methods

increment  

Public Class methods

Increments the counter

[Source]

    # File lib/counter.rb, line 6
 6:   def self.increment(name, value)
 7:     if name.is_a?(Symbol)
 8:       name = (
 9:         case name
10:         when :permission
11:           'com.liferay.portal.model.Permission'
12:         when :resource
13:           'com.liferay.portal.model.Resource'
14:         end
15:       )
16:     end
17:     c = self.find(name)
18:     c.currentid += value
19:     c.save
20:   end

[Validate]