class Decidim::ViewModel
Public Instance Methods
call(*)
click to toggle source
Calls superclass method
# File lib/decidim/view_model.rb, line 30 def call(*) identifier = self.class.name.sub(/Cell$/, "").underscore instrument(:cell, identifier: identifier) do |_payload| super end end
current_user()
click to toggle source
# File lib/decidim/view_model.rb, line 26 def current_user context&.dig(:current_user) || controller&.current_user end
Private Instance Methods
cache_hash()
click to toggle source
# File lib/decidim/view_model.rb, line 49 def cache_hash nil end
decidim()
click to toggle source
# File lib/decidim/view_model.rb, line 53 def decidim Decidim::Core::Engine.routes.url_helpers end
instrument(name, **options) { |payload| ... }
click to toggle source
# File lib/decidim/view_model.rb, line 39 def instrument(name, **options) ActiveSupport::Notifications.instrument("render_#{name}.action_view", options) do |payload| yield payload end end
perform_caching?()
click to toggle source
# File lib/decidim/view_model.rb, line 45 def perform_caching? cache_hash.present? end