Search code examples
ruby-on-railsrubyrubygemsasciidoctor

Using Asciidoctor in Rails


i tried to use asciidoctor gem in my rails app. I added it to my Gemfile and made bundle install.

Now i try to use asciidoctor within a Controller:

def show
  @article.text = Asciidoctor.render(@article.text)
end

But i get an error:

uninitialized constant ArticlesController::Asciidoctor

Whats the right way to user asciidoctor-gem with rails?


Solution

  • Please remember to restart your server after changing something outside the Rails auto-reloading path (i.e. app/* and config/routes.rb).

    Since the documentation looks exactly like your example

    puts Asciidoctor.render '*This* is http://asciidoc.org[AsciiDoc]!'
    

    I'd guess, you simply forgot to restart the server.