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

undefined method `content_tag' for Apipie::ApipiesController #353

Closed
yoyos opened this issue Apr 7, 2015 · 12 comments
Closed

undefined method `content_tag' for Apipie::ApipiesController #353

yoyos opened this issue Apr 7, 2015 · 12 comments

Comments

@yoyos
Copy link

yoyos commented Apr 7, 2015

Showing C:/Ruby21/lib/ruby/gems/2.1.0/gems/apipie-rails-0.3.4/app/views/apipie/apipies/_method_detail.erb where

line 9 AND 34

raised:

undefined method `content_tag' for #Apipie::ApipiesController:0xd10b3b0
Trace of template inclusion: C:/Ruby21/lib/ruby/gems/2.1.0/gems/apipie-rails-0.3.4/app/views/apipie/apipies/method.html.erb

This error occurs only with last 0.3.4 gem version. 0.3.3 was OK.

My code sample:

    api :POST, '/test.json', 'Test title'
    param :phone, String, required: true, desc: 'Phone'
    error 500, 'Error occurred'
    description <<-EOS
      All parameters are case insensitive.
      This webservice let you request a test      
      == JSON Status 200
    EOS
    def request_test
       (...)
    end
@zeitnot
Copy link

zeitnot commented Apr 8, 2015

I have the same problem. I am using 'rails', '4.1.9'.

@yoyos
Copy link
Author

yoyos commented Apr 8, 2015

I'm using gem 'rails', '4.2.1'

yoyos referenced this issue Apr 8, 2015
…ssue

added heading helper_method to controller for when helper is not loaded
@yoyos
Copy link
Author

yoyos commented Apr 8, 2015

I tested to include ActionView::Helpers::TagHelper and it seems to work.

@zeitnot
Copy link

zeitnot commented Apr 8, 2015

@yoyos Where did you add this?

@yoyos
Copy link
Author

yoyos commented Apr 8, 2015

in the helper or controller. Don't know the right place but it worked in both.

https://github.com/Apipie/apipie-rails/blob/master/app/controllers/apipie/apipies_controller.rb
https://github.com/Apipie/apipie-rails/blob/master/app/helpers/apipie_helper.rb

It seems somebody already made a pullrequest :)
#350

@yoyos yoyos closed this as completed Apr 8, 2015
@thiensubs
Copy link

I think Helper file is good then controller.
https://github.com/Apipie/apipie-rails/blob/master/app/helpers/apipie_helper.rb
And i was added:
include ActionView::Helpers::TagHelper
include ActionView::Context
And file helper will be:

module ApipieHelper
include ActionView::Helpers::TagHelper
include ActionView::Context
def heading(title, level=1)
content_tag("h#{level}") do
title
end
end
end

@bastengao
Copy link

I heavily expect this fix to be released in new version.

@avokhmin
Copy link
Contributor

I heavily expect this fix to be released in new version.

+1

@olegantonyan
Copy link

+1

1 similar comment
@dbackowski
Copy link
Contributor

👍

@lasloandrei
Copy link

it affected rails 4.2.2 as well, the fix works

@GabKlein
Copy link

GabKlein commented Oct 1, 2015

+1

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

No branches or pull requests

9 participants