24小时后,我试图找到我的应用程序的问题.我终于找到了问题.
我跑了
rake assets:precompile RAILS_ENV=production
Run Code Online (Sandbox Code Playgroud)
我一直在收到这个错误.
/Users/vezu/.rvm/rubies/ruby-1.9.3-p194/bin/ruby /Users/vezu/.rvm/gems/ruby-1.9.3-p194@global/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
rake aborted!
database configuration does not specify adapter
Tasks: TOP => environment
(See full trace by running task with --trace)
rake aborted!
Command failed with status (1): [/Users/vezu/.rvm/rubies/ruby-1.9.3-p194/bi...]
Run Code Online (Sandbox Code Playgroud)
我的database.yml文件看起来像这样
development:
adapter: postgresql
host: localhost
encoding: unicode
database: ndoda_development
pool: 5
username:
password:
test:
adapter: postgresql
encoding: unicode
database: ndoda_test
pool: 5
Run Code Online (Sandbox Code Playgroud) 我和Heroku以及Carrierwave Gem有点失落.我已经阅读了WIKI,阅读我并搜索网络,我承认,我需要帮助.一切都在当地很好,但Heroku粉碎了应用程序.
/// HEROKU LOGS的错误消息
2012-01-03T17:33:26+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/carrierwave-0.5.8/lib/carrierwave/uploader/configuration.rb:91:in `eval': uninitialized constant CarrierWave::Storage::Fog (NameError
Run Code Online (Sandbox Code Playgroud)
/// GEM文件
gem "fog"
gem 'carrierwave'
Run Code Online (Sandbox Code Playgroud)
/app/uploaders/avatar_uploader.rb
storage :fog
Run Code Online (Sandbox Code Playgroud)
/config/initializers/carrierwave.rb
CarrierWave.configure do |config|
config.fog_credentials = {
:provider => 'AWS',
:aws_access_key_id => 'XXXX',
:aws_secret_access_key => 'XXXX',
:region => 'eu-west-1' # optional, defaults to 'us-east-1'
}
config.fog_directory = 'site_images' # required
config.fog_public = true # optional, defaults to true
config.fog_attributes = {'Cache-Control'=>'max-age=315576000'} # optional, defaults to {}
end
Run Code Online (Sandbox Code Playgroud)
当我将存储更改为文件而不是雾时,我不会得到错误.我是否正在跳过或丢失任何其他雾设置.任何帮助非常感谢.我是否需要创建具有雾设置的单独文档?
我刚刚添加了gem'carrierwave',它正在破坏护栏4.0.我添加了rubyzip gem,但它无法解决问题.我无法再运行任何测试,我无法弄清楚如何解决这个问题.
后卫 - 德布格
19:11:40 - DEBUG - Command execution: growlnotify --version
19:11:40 - DEBUG - Command execution: emacsclient --eval '1' 2> /dev/null || echo 'N/A'
19:11:40 - INFO - Guard is using TerminalTitle to send notifications.
19:11:40 - DEBUG - Command execution: hash stty
19:11:40 - DEBUG - Guard starts all plugins
19:11:40 - DEBUG - Hook :start_begin executed for Guard::Spork
19:11:40 - DEBUG - Command execution: ps aux | grep -v guard | awk '/spork/&&!/awk/{print $2;}'
19:11:40 …Run Code Online (Sandbox Code Playgroud) 学习如何使用Rspec 3.我对匹配器有疑问.我关注的教程基于Rspec 2.
describe Team do
it "has a name" do
#Team.new("Random name").should respond_to :name
expect { Team.new("Random name") }.to be(:name)
end
it "has a list of players" do
#Team.new("Random name").players.should be_kind_of Array
expect { Team.new("Random name").players }.to be_kind_of(Array)
end
end
Run Code Online (Sandbox Code Playgroud)
为什么代码导致错误,而我注释掉了通过折旧警告.
错误
Failures:
1) Team has a name
Failure/Error: expect { Team.new("Random name") }.to be(:name)
You must pass an argument rather than a block to use the provided matcher (equal :name), or the matcher must implement `supports_block_expectations?`.
# ./spec/team_spec.rb:7:in …Run Code Online (Sandbox Code Playgroud) 使用devise gem和获取JWT令牌时遇到问题devise-jwt gem。这就是我的确认结果。
devise.rb
Devise.setup do |config|
config.jwt do |jwt|
jwt.secret = SECRETS.devise_jwt_secret_key
jwt.dispatch_requests = [ ['POST', %r{^/authentication_tokens/create$}] ]
end
end
Run Code Online (Sandbox Code Playgroud)
user.rb
class User < ApplicationRecord
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
:jwt_authenticatable, jwt_revocation_strategy: Devise::JWT::RevocationStrategies::Null
end
Run Code Online (Sandbox Code Playgroud)
authentication_tokens_controller.rb
class Api::V1::AuthenticationTokensController < Devise::SessionsController
include Devise::Controllers::Helpers
skip_before_action :verify_authenticity_token
prepend_before_action :require_no_authentication, only: [:create]
before_action :rewrite_param_names, only: [:create]
def new
render json: { response: "Authentication required" }, status: 401
end
def create
self.resource = warden.authenticate!(auth_options)
sign_in(resource_name, resource)
yield resource if …Run Code Online (Sandbox Code Playgroud) 我正在尝试设置JPlayer插件和Shoutcast.根据他们的网站,这是可能的.
如何让jPlayer播放SHOUTCast流?您需要将媒体设置为流URL.例如,SHOUTcast服务器:http://mp3-vr-128.as34763.net/ MP3流URL:http: //mp3-vr-128.as34763.net/; stream/1
我试过这样做
<script type="text/javascript">
//<![CDATA[
$(document).ready(function(){
$("#jquery_jplayer_1").jPlayer({
ready: function (event) {
$(this).jPlayer("setMedia", {
m4a:"http://77.68.106.224:8018;stream/1",
oga:"http://77.68.106.224:8018"
}).jPlayer("play");
},
swfPath: "js",
supplied: "m4a, oga, mp3",
wmode: "window"
});
});
//]]>
</script>
Run Code Online (Sandbox Code Playgroud)
我的设置没有任何输出.是否有人使用JPlayer进行shoutcast Stream,或者任何人都可以建议不需要php的播放器.
我在理解错误日志时遇到问题.我正在使用Active Admin,一切都在我的本地服务器上运行良好但是当我推送到Heroku时我无法登录或使用活动管理员.关于问题是什么,我有点困惑.我妻子的前端工作,但当我第一次尝试登录时,我收到此错误.
我跑了
heroku run rake db:migrate
Run Code Online (Sandbox Code Playgroud)
application.rb中
config.assets.initialize_on_precompile = false
Run Code Online (Sandbox Code Playgroud)
的routes.rb
break if ARGV.join.include? 'assets:precompile'
Run Code Online (Sandbox Code Playgroud)
Heroku日志
2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/responder.rb:153:in `respond'
2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/responder.rb:146:in `call'
2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/mime_responds.rb:239:in `respond_with'
2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/devise-2.1.0/app/controllers/devise/sessions_controller.rb:9:in `new'
2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/abstract_controller/base.rb:167:in `process_action'
2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/rendering.rb:10:in `process_action'
2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:436:in `_run__2148348972389484395__process_action__581573497384646045__callbacks'
2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:405:in `__run_callback'
2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:81:in `run_callbacks'
2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/abstract_controller/callbacks.rb:17:in `process_action'
2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/rescue.rb:29:in `process_action'
2012-06-01T06:11:53+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.3/lib/action_controller/metal/instrumentation.rb:30:in `block in …Run Code Online (Sandbox Code Playgroud) 尝试设置SSL以在mydomain.com上运行.遵循Heroku文档,我已经管理好了SSL工作在https://secure.mydomain.com.但是当我添加SSL时由heroku创建的实际端点仍在说
**Heroku | No such app**
There is no app configured at that hostname.
Perhaps the app owner has renamed it, or you mistyped the URL.
Run Code Online (Sandbox Code Playgroud)
关于如何让tokyo-2121.herokussl.com指向我在Heroku上的实际应用程序,我有点困惑.
emet:myapp vezu$ heroku certs
Endpoint Common Name(s) Expires Trusted
------------------------ --------------------- ------------------------ -------
tokyo-2121.herokussl.com secure.mydomain.com 2013-09-09 12:28:05 CEST True
Run Code Online (Sandbox Code Playgroud)
然后
emet:myapp vezu$ heroku certs:info
Fetching information on SSL endpoint tokyo-2121.herokussl.com... done
Certificate details:
subject: /serialNumber=htilpsjjgrrlhyVZ8rbeandz78555bgpWx/FDEVd/OU=GT166968518/OU=See www.rapidssl.com/resources/cps (c)12/OU=Domain Control Validated - RapidSSL(R)/CN=secure.mydomain.com
start date: 2012-09-06 12:38:54 CEST
expire date: 2013-09-09 …Run Code Online (Sandbox Code Playgroud) 我正在研究我的第一个Rails应用程序.我有点卡住了时间.我正在研究食谱应用程序.我需要添加两个字段.
在这两个中,我想添加两个字段来计算准备餐点所需的总时间.
我接近它错误的方式,没有逻辑:(.基本上我有两个字段,我使用f.select选择预定义的时间.但我的方法的问题是,当添加两个,它忽略了格里高利格式例如40分钟+ 50分钟将变为90分钟而不是1小时30分钟.
我很感激社区的帮助.
使用法语在rails应用程序上工作,但每当我在flash消息中包含重音时,它就会破坏站点.
例如
format.html {redirect_to @message.annonce, notice:"Votre message a été envoyé"}
format.html {redirect_to @message.annonce, notice:"Votre email n'a pas pu être envoyer à cause d'une erreur."}
Run Code Online (Sandbox Code Playgroud)
我的config/application.rb看起来像这样
config.i18n.default_locale = :fr
config.encoding = "utf-8"
Run Code Online (Sandbox Code Playgroud)
人们如何做到这一点?
我刚刚离线创建应用程序后转移到了站点5.我有耙子的问题.当我尝试运行cd~/MYAPP /; rake db:migrate --trace RAILS_ENV ='production'
我收到以下错误
你已经激活了rake 0.8.7,但你的Gemfile需要rake 0.9.2.考虑使用bundle exec.
当我尝试取消rake 0.8.7时,我得到以下警告.
addressable-2.2.6 depends on [rake (>= 0.7.3)]
execjs-1.2.6 depends on [rake (>= 0)]
execjs-1.2.4 depends on [rake (>= 0)]
friendly_id-3.3.0.1 depends on [rake (~> 0.9.2)]
launchy-2.0.5 depends on [rake (~> 0.9.2)]
multi_json-1.0.3 depends on [rake (~> 0.9)]
orm_adapter-0.0.5 depends on [rake (>= 0.8.7)]
rack-1.3.2 depends on [rake (>= 0)]
rack-1.2.3 depends on [rake (>= 0)]
rack-mount-0.8.3 depends on [rake (>= 0)]
railties-3.1.0 depends on [rake (>= …Run Code Online (Sandbox Code Playgroud) 当我尝试在下面的数据上使用ES6 时,我很难理解为什么会出现错误.find.我正在尝试获取身份证号码为3的记录.
{
{id:10,title:'Dairy & Eggs'}
{id:7,title:'Laundry & Househo,}
{id:9,title:'Bakery'}
{id:8,title:'Fresh Food'}
{id:4,title:'Frozen Food'}
{id:6,title:'Health & Beauty'}
{id:3,title:'Food Cupboard'}
{id:5,title:'Drinks'}
{id:2,title:'Chilled Food'}
}
Run Code Online (Sandbox Code Playgroud)
我试过了
const category = categories.find(function (category) { return category.id === 3; }
console.log(category)
Run Code Online (Sandbox Code Playgroud)
和
const category = categories.filter(category => category.id === 3)
console.log(category)
Run Code Online (Sandbox Code Playgroud)
任何帮助表示赞赏.
我有一个优惠券模型,我试图计算你从原始交易中节省多少.
Coupons.rb
def original_deal
original_price
end
def our_deal
deal_price
end
def percentage_off
original_deal / our_deal * 100.ceil
end
Run Code Online (Sandbox Code Playgroud)
Show.html
<%= number_to_percentage(@coupon.percentage_off, :precision => 2) %>
Run Code Online (Sandbox Code Playgroud)
优惠券信息
original_price = £100.00
deal_price = £90.00
Run Code Online (Sandbox Code Playgroud)
结果.
我得到111.11%的答案.我错过了什么?
heroku ×3
ruby ×3
carrierwave ×2
activeadmin ×1
amazon-s3 ×1
devise ×1
dns ×1
dnsimple ×1
ecmascript-6 ×1
encoding ×1
fog ×1
form-helpers ×1
guard ×1
javascript ×1
jplayer ×1
jquery ×1
jwt ×1
localization ×1
percentage ×1
postgresql ×1
rake ×1
reactjs ×1
recipe ×1
routes ×1
rspec ×1
rspec-rails ×1
rspec3 ×1
shoutcast ×1
timer ×1
typescript ×1
utf-8 ×1