How to use ActionView :: Helpers :: NumberHelper rails in Sinatra?

I want to use the Rails module ActionView :: Helpers :: NumberHelper in my Sinatra views. In particular, I would like to use number_to_currency, although I would like to have additional Rails helpers.

If Sinatra has a more suitable stone that provides a currency number, this will work too. For example, I looked at Sinatra - more, but it does not process currency.

PS. I am using the bundler.

+3
source share
2 answers

Add require 'active_support'sinatra to the top of your application and include the active_support gem in the gem list.

Sinatra , Money.

require "money" ( ).

: http://money.rubyforge.org/

+2

, :

require 'active_support'

... ActiveSupport, ( , AS). , :

Gemfile.rb

gem 'activesupport', require: 'active_support/all'

Gemfile ( Bundler).

+2

Source: https://habr.com/ru/post/1790101/


All Articles