Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define methods on dynamic module #703

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Commits on Jul 3, 2024

  1. Define methods on dynamic module

    Currently you cannot override the generated methods and access super ie:
    
    ```ruby
    monetize :price_cents
    
    def price=(value)
       # stuff
       super # NoMethodError
    end
    ```
    
    This happens because the method is defined on the class directly so their is no super method to call. A solution today is to create an alias (`alias :old_price= :price=`) before overriding the method as is recommending in issue RubyMoney#507.
    
    Instead, a new module can be created, included into the class, and the methods defined on it allowing `super` to work as expected.
    jbennett committed Jul 3, 2024
    Configuration menu
    Copy the full SHA
    9030ec3 View commit details
    Browse the repository at this point in the history
  2. update changelog

    jbennett committed Jul 3, 2024
    Configuration menu
    Copy the full SHA
    e6e5a8e View commit details
    Browse the repository at this point in the history

Commits on Jul 4, 2024

  1. Configuration menu
    Copy the full SHA
    d2faaf4 View commit details
    Browse the repository at this point in the history