If I want to create a new rail pearl that adds methods to Rails views, what is the right way to do this? Extend ActionView :: Base? Will this be related to ApplicationHelper in some way?
Many gem authors create a module that defines their helper viewing methods and then includes them in ActionView::Base .
ActionView::Base
module MyGem module ActionViewExtensions module MyHelpers def my_view_helper # ... end end end end # You can do this here or in a Railtie ActionView::Base.send :include, MyGem::ActionViewExtensions::MyHelpers
Railtie Method:
https://github.com/mynameisrufus/sorted/blob/master/lib/sorted/railtie.rb
Alternative:
https://github.com/plataformatec/simple_form/blob/master/lib/simple_form/action_view_extensions/form_helper.rb
Source: https://habr.com/ru/post/1403062/More articles:invalid foreach loop for complex dictionary - dictionaryHow to make my button do something in Fragments, ViewPager - androidHow to install a product only once on a 64-bit OS? - 64bitHow to display byte image on asp.net page dynamically? - asp.netHow can I parse a string and return an Enum value in Apex code? - apex-codeSmack on Android, getting the error code = "404" the remote server is not found when sending packets / messages between two users through the local Openfire server - androidTF command line tool: compare local source code files with pending TFS files - command-lineProblems using extensions in tel: hyperlinks on Android 4 - androidSQL Server AVG function to return NULL if all NULL values ββare nullJavascript selection date and / or time - javascriptAll Articles