class AppRegistry
extend RequestRegistry.new(:user, :account)
end
Set it in controller
class ApplicationController < ActionController::Base
before_action :provide_registry_information
private
def provide_registry_information
AppRegistry.user = current_user
AppRegistry.account = 'my awesome account'
end
end
And get it in model
class Post < ActionController::Base
belongs_to :author
before_save :set_author
private
def set_author
self.author = AppRegistry.user.presence
end
end