Title: What's the right way to make new methods available to views from a Rails Gem?
Tags: ruby-on-rails;actionview
Question: If I want to create a new rails gem that adds methods to Rails views what is the right way to do this?  Is it to extend ActionView75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0se?   Would it involve ApplicationHelper in some way?

Here is the accepted answer: Many gem authors create a module that defines their view helper methods and then includes them in ActionView75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0se.
module MyGem
module ActionViewExtensions
module MyHelpers
def my_view_helper
# ...
end
end
# You can do this here or in a Railtie
ActionView75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0se.send :include, MyGem75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0tionViewExtensions75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0MyHelpers
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': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2012:00:03/23/12', 'FavoriteCount': 4.0, 'PostTypeId': 1, 'Tags': '<ruby-on-rails><actionview>', 'Title': "What's the right way to make new methods available to views from a Rails Gem?", 'ViewCount': 1421, 'id': 9838599, 'user_AboutMe': '', 'user_AccountId': 932319.0, 'user_DisplayName': 'Inc1982', 'user_Reputation': 1945.0, 'user_Views': 134.0, 'user_id': 961935.0}}