为什么mount_griddler是一个未定义的方法?

时间:2013-07-23 23:48:18

标签: ruby-on-rails ruby gem griddler

我正在尝试使用Griddler gem,并在我的Gemfile中为'griddler'做了一个bundle install。在我的routes.rb中,我添加了一行:

mount_griddler ('/email/incoming')

当我尝试运行rails s时,我不断收到错误:

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

我还在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

如果有人能告诉我哪里出错了,我会很感激。

我的Gemfile如下:

  

来源'https://rubygems.org'

     

gem'trail','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'

捆绑安装输出

   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)

你的包已经完成了!

的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

1 个答案:

答案 0 :(得分:0)

最新发布的Griddler版本v0.5.0未包含mount_griddler帮助程序。

在该版本中,引擎会自动将路由添加到POST/email_processorREADME指定在需要时覆盖该路由的方法。

将来的版本需要mount_griddler中的config/routes.rb方法,并提供更多的灵活性。

很抱歉。