I’m trying to use the rails_autolink gem.
As usual, I added the gem declaration to my gemfile:
gem 'rails_autolink'
Then ran “bundle install”, restarted my rails local server and
Then I added to my posts_controller the require before the class declaration
require 'rails_autolink'
class PostsController < ApplicationController
...
and used the auto_link method inside my create action
def create
@new_post = Post.new(params[:post])
if @new_post.content == ""
redirect_to posts_url
else
@new_post.content = auto_link(@new_post.content)
... #respond_to and save methods
end
end
end #end of my post controller
The thing is that when I try to create a post I have a undefined method on the auto_link method, any idea why ? Is it specific to the gem or is it because something else ?
This is a view helper which you’re trying to use in a controller