Skip to content

add increment! and decrement! methods #365

Closed
@catmando

Description

@catmando

these are active record methods:

Implementation is simple:

  def increment!(attr)
    Hyperstack::Model.load { send(attr) }.then { |current_value| update(attr => current_value+1) }
  end if RUBY_ENGINE == 'opal'

The above can be added to your ApplicationRecord.rb file for now

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions