每当我尝试运行cap production deploy它时,在以下命令失败
[ebbf9fde] Command: cd /var/www/apps/my_app/releases/20150803171251 && /usr/local/rvm/bin/rvm 2.2.2 do bundle install --path /var/www/apps/my_app/shared/bundle --without development test --deployment --quiet
DEBUG [ebbf9fde] /usr/local/rvm/scripts/set: line 19: exec: bundle: not found
Run Code Online (Sandbox Code Playgroud)
我添加了一个用户'deploy'来执行此部署,输出rvm list是
$ rvm list
rvm rubies
=* ruby-2.2.2 [ x86_64 ]
# => - current
# =* - current && default
# * - default
Run Code Online (Sandbox Code Playgroud)
进一步运行gem列表的输出是
$ gem list
*** LOCAL GEMS ***
bigdecimal (1.2.6)
bundler-unload (1.0.2)
executable-hooks (1.3.2)
gem-wrappers (1.2.7)
io-console (0.4.3)
json (1.8.1)
minitest …Run Code Online (Sandbox Code Playgroud) 我正在定义一个名为“联系人”的表中存在的一些字段的验证:
class Contact < ActiveRecord::Base
validates :nome, :cognome, :indirizzo_abitazione,
:numero_civico, :indirizzo_email, :prefisso_cellulare, :cellulare, presence: true
validates :nome, :cognome, :indirizzo_email,
:prefisso_cellulare, :cellulare, uniqueness: true
validates :indirizzo_email, format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i, on: :create }
end
Run Code Online (Sandbox Code Playgroud)
如果存在错误,我想利用引导程序的类属性“has-error”以红色突出显示特定字段;所以我试图以这种方式做到这一点:
<div class="form-group <%= @contact.errors[:name] ? "has-error" : "" %>" >
<%= f.label :name , :class => "control-label" %><br>
<%= f.text_field :name, :class => "form-control" %>
</div>
Run Code Online (Sandbox Code Playgroud)
但是当我登录到这个页面时,该字段已经是红色的。有没有一种方法可以查看在验证一条记录期间,特定字段是否出现错误?
我正在使用Rails 4.2.3.我无法将可变数量的搜索条件传递给我的Rails finder方法.我有
user = current_user
search_criteria = ["my_objects.user_id = ?"]
search_values = [user.id]
start_date = params[:start_date]
if start_date.present?
start_date_obj = Date.strptime(start_date, "%m/%d/%Y")
search_criteria.push("my_objects.start_date >= ?")
search_values.push(start_date_obj)
else
start_date = my_object.find_user_first_my_object_date(user)
@default_start_date = start_date.to_time.strftime("%m/%d/%Y") if start_date.present?
end
end_date = params[:end_date]
if end_date.present?
end_date_obj = Date.strptime(end_date, "%m/%d/%Y")
search_criteria.push("my_objects.end_date <= ?")
search_values.push(end_date_obj)
else
end_date = my_object.find_user_last_my_object_date(user)
@default_end_date = end_date.to_time.strftime("%m/%d/%Y") if end_date.present?
end
distance = params[:distance]
if distance.present?
distance_parts = distance.split(" ")
search_criteria.push("my_objects.distance = ?")
search_criteria.push("my_objects.distance_unit_id = ?")
search_values.push("#{distance_parts[0]}")
search_values.push("#{distance_parts[1]}")
end
@user_my_objects = …Run Code Online (Sandbox Code Playgroud)