Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails 3.0.x: undefined method *heading*, issue with ActionDispatch::Reloader #251

Closed
jensb opened this issue May 24, 2014 · 5 comments · Fixed by #348
Closed

Rails 3.0.x: undefined method *heading*, issue with ActionDispatch::Reloader #251

jensb opened this issue May 24, 2014 · 5 comments · Fixed by #348

Comments

@jensb
Copy link

jensb commented May 24, 2014

Using Rails 3.0.20 and Ruby 1.9.3, I get this error when trying to access the apipie index:

NoMethodError in Apipie/apipies#index

Showing .../ruby1.9/gems/1.9.1/gems/apipie-rails-0.1.3/app/views/apipie/apipies/_method_detail.erb where line #34 raised:

undefined method `heading' for #<#Class:0x007fabe6e27770:0x007fabe6ddc658>
Extracted source (around line #34):

31: <% end %>
32: 
33: <% unless method[:params].blank? %>
34:   <%= heading('Params', h_level) %>
35:   <table class='table'>
36:     <thead>
37:       <tr>

If this is Rails-3.0 specific: I know that Rails 3.0 is deprecated, but if a fix is trivial (it's in a template, after all), can you provide a patch?
Thank you!

@iNecas
Copy link
Member

iNecas commented May 26, 2014

Hi,

I will be happy to review the patch

@jensb
Copy link
Author

jensb commented May 26, 2014

I don't have a patch - sorry :) It just looks like your "heading(...)" helper isn't included and thus throws an unknown_method on each page. Since this is the only helper and it is trivial, I just included the method in my main ApplicationHelper, and now it seems to work.

Still, I'd like to know why the apipie_helper.rb isn't being loaded.

@jensb jensb changed the title undefined method *heading* in app/views/apipie/apipies/_method_detail.erb Rails 3.0.x: undefined method *heading*, issue with ActionDispatch::Reloader May 31, 2014
@jensb
Copy link
Author

jensb commented May 31, 2014

Also, for Rails 3.0 it is necessary to duplicate / monkey-patch Apipie::Application, eg. append to config/initializers/apipie.rb:

module Apipie
class Application
  def rails_mark_classes_for_reload
    unless Rails.application.config.cache_classes
      #ActionDispatch::Reloader.cleanup!
      init_env
      reload_examples
      #ActionDispatch::Reloader.prepare!
    end
  end
end
end

@saneshark
Copy link
Contributor

🐛 This is an issue on: rails (4.0.12) and ruby 2.1.5

@saneshark
Copy link
Contributor

@iNecas this seems to have resolved the issue for my project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants