小编Mat*_*hew的帖子

试图在Javascript中将回车转换为<br /> html标签?

我有一个XML提要,我通过javascript拉它并将其转换为更友好的HTML,但我抓住了如何将回车转换为html br标签

我试过这样的事

text = text.replace('\r','<br />'); 
Run Code Online (Sandbox Code Playgroud)

无济于事..

有任何想法吗?

javascript

12
推荐指数
3
解决办法
2万
查看次数

Rails环境配置:`method_missing':未定义的方法`action_mailer'

尝试调用Rails控制台(bundle exec rails c)或Rails服务器(bundle exec rails s)会导致抛出以下异常:

~/project/.bundle/gems/railties-4.2.6/lib/rails/railtie/configuration.rb:95:in `method_missing': undefined method `action_mailer' for #<Rails::Application::Configuration:0x007fdbe46e7400> (NoMethodError)
    from ~/project/config/environments/development.rb:43:in `block in <top (required)>'
    from ~/project/.bundle/gems/railties-4.2.6/lib/rails/railtie.rb:210:in `instance_eval'
    from ~/project/.bundle/gems/railties-4.2.6/lib/rails/railtie.rb:210:in `configure'
    from ~/project/config/environments/development.rb:1:in `<top (required)>'
    from ~/project/.bundle/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
...
Run Code Online (Sandbox Code Playgroud)

我在这里或那里遗漏了一些可能导致不兼容问题的宝石吗?

这是违规行config/environments/development.rb:

  # Save emails to files instead of delivering.
  config.action_mailer.delivery_method = :file
Run Code Online (Sandbox Code Playgroud)

以下是我的Gemfile的内容:

source 'https://rubygems.org'

gem 'rails', '4.2.6'
gem 'activemodel'
gem 'actionmailer'
gem 'sass-rails', '~> 5.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'rollbar'
gem 'meta-tags'
gem 'faraday'
gem 'oj' …
Run Code Online (Sandbox Code Playgroud)

bundle rubygems ruby-on-rails actionmailer ruby-on-rails-4

5
推荐指数
1
解决办法
4278
查看次数