ruby-on-railsrubyrubygemsgriddler

Why is mount_griddler an undefined method?


I am trying to use the Griddler gem, and did a bundle install for 'griddler' in my Gemfile. In my routes.rb I added the line:

mount_griddler ('/email/incoming')

When I try running rails s, I keep getting the error:

'block in <top (required)>': undefined method 'mount_griddler' for #<ActionDispatch::Routing::Mapper:0x007fa995bba030> (NoMethodError)

I also created a file in config/initializer/griddler:

   Griddler.configure do |config|
   config.processor_class = EmailProcessor # MyEmailProcessor
   config.to = :token # :full, :email, :hash
   config.reply_delimiter = '-- REPLY ABOVE THIS LINE --'
   config.email_service = :sendgrid
 end

I'd appreciate it if someone could tell me where I went wrong.

My Gemfile as below:

source 'https://rubygems.org'

gem 'rails', '3.2.13'

    gem 'pg'
    gem 'mail'
    gem 'griddler'

 group :development, :test do
  gem 'quiet_assets'
  gem 'pry'
  gem 'rspec-rails'
  gem 'faker'
  gem 'factory_girl_rails'
  gem 'guard-rspec'
end

 group :test do
   gem 'capybara'
   gem 'poltergeist'
   gem 'database_cleaner'
   gem 'shoulda-matchers'
   gem 'simplecov', require: false
 end


 group :assets do
   gem 'sass-rails',   '~> 3.2.3'
   gem 'coffee-rails', '~> 3.2.1'



  gem 'uglifier', '>= 1.0.3'
end

  gem 'jquery-rails'

Bundle install output

   Using rake (10.1.0)
   Using i18n (0.6.1)
   Using multi_json (1.7.7)
   Using activesupport (3.2.13)
   Using builder (3.0.4)
   Using activemodel (3.2.13)
   Using erubis (2.7.0)
   Using journey (1.0.4)
   Using rack (1.4.5)
   Using rack-cache (1.2)
   Using rack-test (0.6.2)
   Using hike (1.2.3)
   Using tilt (1.4.1)
   Using sprockets (2.2.2)
   Using actionpack (3.2.13)
   Using mime-types (1.23)
   Using polyglot (0.3.3)
   Using treetop (1.4.14)
   Using mail (2.5.4)
   Using actionmailer (3.2.13)
   Using arel (3.0.2)
   Using tzinfo (0.3.37)
   Using activerecord (3.2.13)
   Using activeresource (3.2.13)
   Using bundler (1.3.5)
   Using mini_portile (0.5.0)
   Using nokogiri (1.6.0)
   Using xpath (2.0.0)
   Using capybara (2.1.0)
   Using coderay (1.0.9)
   Using coffee-script-source (1.6.2)
   Using execjs (1.4.0)
   Using coffee-script (2.2.0)
   Using rack-ssl (1.3.3)
   Using json (1.8.0)
   Using rdoc (3.12.2)
   Using thor (0.18.1)
   Using railties (3.2.13)
   Using coffee-rails (3.2.2)
   Using database_cleaner (1.0.1)
   Using diff-lcs (1.2.4)
   Using eventmachine (1.0.3)
   Using factory_girl (4.2.0)
   Using factory_girl_rails (4.2.1)
   Using faker (1.1.2)
   Using faye-websocket (0.4.7)
   Using ffi (1.9.0)
   Using formatador (0.2.4)
   Using htmlentities (4.3.1)
   Using rails (3.2.13)
   Using griddler (0.5.0)
   Using rb-fsevent (0.9.3)
   Using rb-inotify (0.9.0)
   Using rb-kqueue (0.2.0)
   Using listen (1.2.2)
   Using lumberjack (1.0.3)
   Using method_source (0.8.1)
   Using slop (3.4.5)
   Using pry (0.9.12.2)
   Using guard (1.8.1)
   Using rspec-core (2.13.1)
   Using rspec-expectations (2.13.0)
   Using rspec-mocks (2.13.1)
   Using rspec (2.13.0)
   Using guard-rspec (3.0.2)
   Using http_parser.rb (0.5.3)
   Using jquery-rails (3.0.1)
   Using pg (0.15.1)
   Using poltergeist (1.3.0)
   Using quiet_assets (1.0.2)
   Using rspec-rails (2.13.2)
   Using sass (3.2.9)
   Using sass-rails (3.2.6)
   Using shoulda-matchers (2.2.0)
   Using simplecov-html (0.7.1)
   Using simplecov (0.7.1)
   Using uglifier (2.1.1)

Your bundle is complete!

routes.rb

RedLantern::Application.routes.draw do

  resources :tickets do
    resources :replies, only: [:create]
  end

  match "/inbound" => "inbound#create"

  mount_griddler ('/email/incoming')

  root :to => "tickets#index"
end

Solution

  • The most recent released version of Griddler, v0.5.0 did not include the mount_griddler helper.

    In that release, the engine automatically adds a route to POST to /email_processor, and the README specifies a way to override that if needed.

    Future releases will require the mount_griddler method in config/routes.rb and provide a little more flexibility.

    Sorry about that.