I have this method which is used in many models.
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
def human_to_number(human)
I wish to call this method from a controller, which doesn't use a model. How?
class StripesController < ApplicationController
def create
@amount = params[:amount]
@amount = ApplicationRecord.human_to_number(@amount)
I tried to define it with self.
but that made all other calls in all models broken.
I tried to include ApplicationRecord
in the controller, but it complained that it needed a module, not a class.
Rails 5.0.6