weppos / breadcrumbs_on_rails

A simple Ruby on Rails plugin for creating and managing a breadcrumb navigation.
https://simonecarletti.com/code/breadcrumbs-on-rails
MIT License
944 stars 188 forks source link

Breadcrumbs don't work if controller action is private #116

Closed SaladFork closed 6 years ago

SaladFork commented 6 years ago
class MyController < ApplicationController
  private
  def my_action
    add_breadcrumb 'Test'
  end
end

The breadcrumbs appear if private is commented out but do not appear if left in. The Rails routing and the rest of the UI works correctly in either case.

weppos commented 6 years ago

Controller actions are not supposed to be private. http://guides.rubyonrails.org/action_controller_overview.html#methods-and-actions

Only public methods are callable as actions. It is a best practice to lower the visibility of methods (with private or protected) which are not intended to be actions, like auxiliary methods or filters.

SaladFork commented 6 years ago

Sorry for the noise, thanks!