Q:

How to share data with all views in Rails?

As the title said what the possible ways to share data with all views?
In Laravel there is a feature that comes with the framework called viewComposers, I don't know if that exists with Rails .

A:

Well, the most simple one is to use application controller
class ApplicationController < ActionController::Base
  before_action :set_somethings

  def set_somethings
    @page_title = 'Acme Corporation'

    # You can also have service classes and call them here
    @settings = MyService.initializeSettings
  end
end

in your views
<%= @page_title %>

