我在我的Rails 4应用程序中使用ckeditor gem .在本地和我的stoku heroku环境中,一切都很好用,但是在推动生产环境时我遇到了这个错误:
GET http://myapp.herokuapp.com/assets/ckeditor/contents.css 404 (Not Found)
GET http://myapp.herokuapp.com/assets/ckeditor/skins/moono/icons.png 404 (Not Found)
Run Code Online (Sandbox Code Playgroud)
编辑器显示良好,但缺少所有图标.
我按照自述文件(https://github.com/galetahub/ckeditor),但我可能错过了一些东西.
这是我的步骤:
1)宝石安装,生成等......
2)config.autoload_paths += %W(#{config.root}/app/models/ckeditor)在application.js中
3)mount Ckeditor::Engine => "/ckeditor"在routes.rb(我不明白为什么)
4)在application.js中
//= require ckeditor/override
//= require ckeditor/init
Run Code Online (Sandbox Code Playgroud)
这究竟是做什么的,为什么需要覆盖呢?(这些文件位于何处,因为没有/app/assets,但/lib/assets两者都没有/vendor/assets)
Heroku是只读的,因此我不能像教程中所解释的那样运行rake任务.我认为这就是我在生产模式中得到错误的原因.
有人遇到过同样的问题吗?我浏览了所有stackoverflow问题,但到目前为止还没有解决我的问题.
更新:
我发现让它工作的唯一方法是实时编译:config.assets.compile = true
但我不想在生产中使用它,我不明白它为什么会起作用.
heroku production-environment ckeditor asset-pipeline ruby-on-rails-4
我想知道哪种方法返回记录最快。
Class.where(:type => 4).first
Class.find(:first, :conditions => ["type = ?", 4])
Run Code Online (Sandbox Code Playgroud)
执行是完全一样的吗?
我有一个模型候选人,设计omniauthable(linkedin).
到目前为止,我的routes.rb看起来像这样:
namespace :v1 do
devise_for :candidates, only: :omniauth_callbacks
...
end
Run Code Online (Sandbox Code Playgroud)
一切顺利,直到我不得不添加新版本:
namespace :v2 do
devise_for :candidates, only: :omniauth_callbacks
...
end
namespace :v1 do
devise_for :candidates, only: :omniauth_callbacks
...
end
Run Code Online (Sandbox Code Playgroud)
使用当前配置,我收到此错误:
`set_omniauth_path_prefix!': Wrong OmniAuth configuration. If you are getting this exception, it means that either: (RuntimeError)
1) You are manually setting OmniAuth.config.path_prefix and it doesn't match the Devise one
2) You are setting :omniauthable in more than one model
3) You changed your Devise routes/OmniAuth setting …Run Code Online (Sandbox Code Playgroud) 这是我用来进行Http调用的代码.我无法重现错误,但Bugsnag告诉我,有些用户收到此错误:java.lang.IllegalStateException StrictMode.java
public class ApiManager {
public interface Callback<T> {
void onError(Throwable e);
void onSuccess(T result);
}
private ApiService _apiService;
public ApiManager() {
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(BuildConfig.BASE_URL)
.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
.addConverterFactory(GsonConverterFactory.create())
.client(ew OkHttpClient())
.build();
_apiService = retrofit.create(ApiService.class);
}
private <T> void execute(Observable<T> observable, final Callback<T> callback) {
observable.subscribeOn(Schedulers.computation())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Subscriber<T>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
callback.onError(e);
}
@Override
public void onNext(T result) {
callback.onSuccess(result);
}
});
}
public void createUser(Callback<Void> …Run Code Online (Sandbox Code Playgroud) Apple最近发布了新版iTunes Connect.我只是想更改我的应用程序的主要语言,但文档(底部的https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/DisplayInMoreLanguages.html)现已弃用.
有谁解决了这个问题?
我的问题很简单,我有一个子串列表,我必须计算特定字符串中包含的子串数.这是我的代码:
string = "..."
substrings = ["hello", "foo", "bar", "brol"]
count = 0
substrings.each do |sub|
count += 1 if string.include?(sub)
end
Run Code Online (Sandbox Code Playgroud)
在这个例子中,我们遍历整个字符串4次,这非常消耗.你会如何优化这个过程?
我有一个用 RoR 编写的后端,我需要管理来自世界各地不同同行的许多请求。我有以下问题:
config.timezone为每个请求更改是否合适?
如果是:
config.timezone?)Time.zone = 'UTC+X'如果不:
activerecord ×1
algorithm ×1
android ×1
ckeditor ×1
devise ×1
heroku ×1
oauth ×1
optimization ×1
retrofit ×1
ruby ×1
rx-android ×1
rx-java ×1
substring ×1
timezone ×1