In my rails 4 app I'm having trouble extracting the twitter gem config from my controller to a module, getting
undefined method `include' for #<UsersController:0x007ff7d566df08>
Users_controller.rb
def show
include Twitconfig
...
end
controllers/concerns/Twitconfig.rb
require 'twitter'
module Twitconfig
@client = Twitter::REST::Client.new do |config|
...
end
end
I've tried moving the "include Twitconfig" to out of the new action like so
class UsersController < ApplicationController
include Twitconfig
but that just gave an undefined method error when calling @client.
This is my first time including a module in rails 4 and I've been trying for a while so any help would be really appreciated.