小编Nat*_*ert的帖子

如何允许webpack-dev-server允许来自react-router的入口点

我正在创建一个使用webpack-dev-server开发的应用程序以及react-router.

似乎webpack-dev-server是基于这样的假设,即在一个地方(即"/")有一个公共入口点,而react-router允许无限量的入口点.

我想要webpack-dev-server的好处,特别是热量重新加载功能,这对于提高工作效率很有帮助,但我仍然希望能够加载在react-router中设置的路由.

如何实现它以便它们一起工作?你能以这种方式在webpack-dev-server前运行快速服务器吗?

javascript reactjs webpack react-router

109
推荐指数
5
解决办法
8万
查看次数

Paperclip错误:NotIdentifiedByImageMagickError

我有一个使用Paperclip的rails安装工作正常一段时间,并且在最近的部署中它已经坏了.我相信它与gemfile更新同时发生,因为机器上的其他内容都没有改变.错误是:

Command :: file -b --mime :file
[paperclip] Error while determining content type: Command 'file -b --mime :file' returned 1. Expected 0
Run Code Online (Sandbox Code Playgroud)

这是我已经验证有效的png文件.当我在图像上运行'file -b --mime'时,我得到:

image/png; charset=binary
Run Code Online (Sandbox Code Playgroud)

之后我也得到了这个:

Command :: identify -format %wx%h :file
[paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: /tmp/song_waveform_3010520121008-23335-165xag4.png20121008-23335-j8e18p is not recognized by the 'identify' command.>
Run Code Online (Sandbox Code Playgroud)

我做了一个文件,它给了我/ usr/bin所以我尝试在production.rb中设置Paperclip.options [:command_path] ="/ usr/bin /"而没有任何变化.

我想不出为什么会发生这种情况.也许它没有指向正确的目录?我在这里有点失落.

ruby-on-rails paperclip

11
推荐指数
1
解决办法
1万
查看次数

使用Rails(3)在to_param中使用正斜杠'/'清除URL

这可能吗?

def to_param
  "#{id}%2F#{slug}"
end
Run Code Online (Sandbox Code Playgroud)

这适用于Chrome和Safari,但如果Firefox在地址栏中看到"%2F".有更干净的方式吗?

ruby-on-rails

4
推荐指数
1
解决办法
3338
查看次数

Postgres选择一个concat字段并在Rails中ILIKE它

很简单,试图这样做

 SELECT  (artist_name || ' ' || name) as full_name FROM "songs"  WHERE "songs"."working" = 't' AND (full_name ILIKE('%Jack Beats%')) AND (full_name ILIKE('%Epidemic%')) AND (full_name ILIKE('%Dillon Francis%')) ORDER BY songs.published_at asc LIMIT 1
Run Code Online (Sandbox Code Playgroud)

但我明白了

ActiveRecord::StatementInvalid: PG::Error: ERROR:  column "full_name" does not exist
Run Code Online (Sandbox Code Playgroud)

我已经尝试在站点之前添加表名,但没有效果.

sql postgresql ruby-on-rails

4
推荐指数
2
解决办法
5075
查看次数

nil:nilclass的未定义方法`status'

尝试将控制器及其索引视图链接在一起时获取此信息。

在控制器中:

class FeedbackController < ApplicationController
  def index
  end
end
Run Code Online (Sandbox Code Playgroud)

而在路线上:

resources :feedback
Run Code Online (Sandbox Code Playgroud)

我得到这个:

NoMethodError in FeedbackController#index

undefined method `status' for nil:NilClass
Run Code Online (Sandbox Code Playgroud)

和此堆栈跟踪:

actionpack (3.2.8) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
activesupport (3.2.8) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.8) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.8) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.8) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.8) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
activerecord (3.2.8) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (3.2.8) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.8) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.8) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.8) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.8) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.8) lib/action_dispatch/routing/route_set.rb:73:in …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails ruby-on-rails-3

3
推荐指数
1
解决办法
1398
查看次数

Rails没有将缓存破坏时间戳附加到生产中的资产

我正在使用stylesheet_link_tag和资产管道,但我得到了这个:

<link href="/assets/application.css" media="screen" rel="stylesheet" type="text/css" />
Run Code Online (Sandbox Code Playgroud)

我的生产.rb

config.serve_static_assets = false
config.assets.compress = true
Run Code Online (Sandbox Code Playgroud)

我假设它是设置或简单的东西..

caching ruby-on-rails asset-pipeline

2
推荐指数
1
解决办法
1675
查看次数