Module: RailsBestPractices::Core::Check::InheritedResourcesable
- Included in:
- Prepares::ControllerPrepare
- Defined in:
- lib/rails_best_practices/core/check.rb
Overview
Helper to indicate if the controller is inherited from InheritedResources.
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 |
# File 'lib/rails_best_practices/core/check.rb', line 327 def self.included(base) base.class_eval do interesting_nodes :class, :var_ref, :vcall interesting_files CONTROLLER_FILES # check if the controller is inherit from InheritedResources::Base. add_callback :start_class do |_node| if current_extend_class_name == 'InheritedResources::Base' @inherited_resources = true end end # check if there is a DSL call inherit_resources. add_callback :start_var_ref do |node| if node.to_s == 'inherit_resources' @inherited_resources = true end end # check if there is a DSL call inherit_resources. add_callback :start_vcall do |node| if node.to_s == 'inherit_resources' @inherited_resources = true end end end end |