I think that most users want to autoload Turbolinks includes onto
ActionController::Base, but not the ActionController::API.  So, should
Turbolinks be checking to see that the class it's including it on is not
ActionController::API? I think this case goes beyond Turbolinks too.  I'm
working on breadcrumbs_on_rails which desires to add behavior on
ActionController::Base, but not ActionController::API. It seems like there
should be a better way, perhaps 3 hooks (action_controller,
action_controller_base, action_controller_api)?


-Justin

On Wed, Aug 10, 2016 at 8:23 AM, Nicholas Firth-McCoy <n...@nfm.id.au> wrote:

> It looks to me like there's a config option for this here:
> https://github.com/turbolinks/turbolinks-rails/blob/master/
> lib/turbolinks.rb#L21. It defaults to true if you require the turbolinks
> gem, but you can set `Rails.application.config.turbolinks.auto_include =
> false` to change the behavior.
>
> I don't know a lot about ActiveSupport's load hooks, but at first glance
> it looks like `ActionController::API` invokes 
> `ActiveSupport.run_load_hooks(:action_controller,
> self)`, which Turbolinks hooks into. Adding a separate load hook (ie.
> `action_controller_api`) would be a breaking change. It's probably easiest
> to use the config option, or not require the turbolinks gem if you aren't
> using it.
>
> On Wednesday, August 10, 2016 at 6:16:49 AM UTC+10, Justin Coyne wrote:
>>
>> I'm wondering why Turbolinks::Redirection and  Turbolinks::Controller are
>> ancestors of ActionController::API.  I suspect that is a bug.  Is there any
>> reason we can't remove it?
>>
>> I suspect this is because both ActionController::API and
>> ActionController::Base call ActiveSupport.run_load_hooks(:
>> action_controller, self) and gems (like turbolinks) are not checking to
>> see which class they are injecting behavior into.
>>
>> What are your thoughts?
>>
>>
>> -Justin
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ruby on Rails: Core" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/rubyonrails-core/q7IXNmGL4Sc/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> rubyonrails-core+unsubscr...@googlegroups.com.
> To post to this group, send email to rubyonrails-core@googlegroups.com.
> Visit this group at https://groups.google.com/group/rubyonrails-core.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-core+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to