为了减少追逐,我有一个任意Heroku域,我想转移到自定义域.我以前从未这样做过.我已经调查了一下,但没有找到足够明确的答案分解成步骤.
所以,我通常不会在将应用程序部署到 heroku 时遇到任何问题,但是,在这种特定情况下,我遇到了预编译失败的错误...
这条线对我来说很突出:
remote: NoMethodError: undefined method `[]' for nil:NilClass
Run Code Online (Sandbox Code Playgroud)
但这里是完整的错误日志:
remote: Bundle completed (9.35s)
remote: Cleaning up the bundler cache.
remote: Removing carrierwave (0.10.0)
remote: Removing foreigner (1.7.4)
remote: Removing mailboxer (0.12.5)
remote: -----> Preparing app for Rails asset pipeline
remote: Running: rake assets:precompile
remote: rake aborted!
remote: NoMethodError: undefined method `[]' for nil:NilClass
remote: (in /tmp/build_3dacd5df86a31726215c3dc3c1c22600/app/assets/stylesheets/application.css)
remote: /tmp/build_3dacd5df86a31726215c3dc3c1c22600/vendor/bundle/ruby/2.2.0/gems/sprockets-2.12.3/lib/sprockets/sass_functions.rb:63:in `sprockets_context'
remote: /tmp/build_3dacd5df86a31726215c3dc3c1c22600/vendor/bundle/ruby/2.2.0/gems/sass-rails-4.0.5/lib/sass/rails/helpers.rb:23:in `asset_url'
remote: /tmp/build_3dacd5df86a31726215c3dc3c1c22600/vendor/bundle/ruby/2.2.0/gems/sass-3.2.19/lib/sass/script/funcall.rb:113:in `_perform'
remote: /tmp/build_3dacd5df86a31726215c3dc3c1c22600/vendor/bundle/ruby/2.2.0/gems/sass-3.2.19/lib/sass/script/node.rb:40:in `perform'
remote: /tmp/build_3dacd5df86a31726215c3dc3c1c22600/vendor/bundle/ruby/2.2.0/gems/sass-3.2.19/lib/sass/tree/visitors/perform.rb:298:in `visit_prop'
remote: /tmp/build_3dacd5df86a31726215c3dc3c1c22600/vendor/bundle/ruby/2.2.0/gems/sass-3.2.19/lib/sass/tree/visitors/base.rb:37:in `visit'
remote: /tmp/build_3dacd5df86a31726215c3dc3c1c22600/vendor/bundle/ruby/2.2.0/gems/sass-3.2.19/lib/sass/tree/visitors/perform.rb:100:in `visit' …Run Code Online (Sandbox Code Playgroud) 简而言之,我刚刚将评论支架迁移到了应用程序.目标是在歌曲的节目动作中显示评论.这很简单,我有歌曲模型,评论模型和用户模型.用户可以上传歌曲 - 我希望用户能够为歌曲添加评论.不幸的是,我遇到了以下错误.我已经研究过各种解决方案但无济于事.
错误消息:
ArgumentError in Songs#show
Showing /Users/apane/Downloads/leap/app/views/comments/_form.html.erb where line #1 raised:
First argument in form cannot contain nil or be empty
<%= form_for @comment do |f| %>
<% if @comment.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@comment.errors.count, "error") %> prohibited this comment from being saved:</h2>
Run Code Online (Sandbox Code Playgroud)
请参阅下面的github - 我觉得这是最有效的故障排除方式,因为很容易快速浏览到相应的目录.
www.github.com/apane/leap
所以,我有这个网站,我已经建立了http://leapfm.com/,越来越多的用户加入这是太棒了.我注意到用户重新登录以检查他们的歌曲是否已被投票.我想为他们自动化这个过程.
所以,我想实现一个功能,当他们的歌曲被投票时向用户发送电子邮件.我不确定我的堆栈是否可以使用.
例如,我正在使用这个宝石投票.
我可以像这样实施一些事情吗?如果您需要我提供任何其他信息,请不要害怕询问.
song_controller snippit(创建动作):
def create
@song = Song.new(song_params)
@song.user = current_user
respond_to do |format|
if @song.save
format.html { redirect_to @song, notice: 'Song was successfully created.' }
format.json { render action: 'show', status: :created, location: @song }
else
format.html { render action: 'new' }
format.json { render json: @song.errors, status: :unprocessable_entity }
end
end
end
Run Code Online (Sandbox Code Playgroud) 这基本上是我先前问题的第2部分,因为我已经根据代码的长度创建了一个新问题.希望我们能够在您的帮助下解决这个问题,我相信我们现在可以通过新信息找到解决方案.
编辑:感谢您的输入.这是pt的链接.1与实际代码:登录功能不起作用.
PS.请不要忘记投票这个问题.
继承人user.rb:
# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# name :string(255)
# email :string(255)
# created_at :datetime not null
# updated_at :datetime not null
# encrypted_password :string(255)
# salt :string(255)
#
class User < ActiveRecord::Base
attr_accessor :password
attr_accessible :email, :name, :password, :password_confirmation
email_regex = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates :name, :presence => true,
:length => { :maximum => 50 }
validates :email, :presence => true,
:format => { …Run Code Online (Sandbox Code Playgroud) 提供一些背景; 在过去的几个月里我一直在学习Ruby(已经阅读了大部分Well-Grounded-Rubyist,完成了Poignant ruby指南,并计划在之后阅读Eloquent ruby)我已经掌握了大多数概念,即Objects,Ruby内核(基础),范围,循环等等,但是,当涉及到向代码发送消息/方法时,我感到很困惑.
我们以这行代码为例: toolkit = Toolkit.get_default_toolkit
现在toolkit是Toolkit对象的变量,get_default_toolkit是方法/消息.我在大多数代码中发现含糊不清的是方法/消息没有在任何地方定义.所以我的问题是,是否有一个我们(rubyists)可以研究的Kernal消息/方法列表,这些消息/方法是在基础层面上使用的?
或者这些方法是否具有较大的范围,并在程序中的其他位置定义?
ruby rubygems ruby-on-rails ruby-on-rails-3 ruby-on-rails-3.1