这是一个奇怪的问题.在irb中,要求'openssl'返回true.进入'which passenger-install-nginx-module'返回的子目录并执行passenger-install-nginx-module.它返回openssl对ruby未找到的支持.
按照以下说明成功构建openssl:
sudo apt-get install libssl-dev
cd ~/.rvm/src/ruby-1.9.2-p290/ext/openssl #ruby p290 installed by rvm
ruby extconf.rb
make && make install
Run Code Online (Sandbox Code Playgroud)
然而,passenger-install-nginx-module总是提示'openssl支持ruby not found'.
有关这个问题的任何想法?谢谢.
客户表中有字段名称激活.它在customer.rb中验证如下:
validates :active, :presence => true
Run Code Online (Sandbox Code Playgroud)
以下是测试字段short_name的rspec代码:
it "should be OK with duplicate short_name in different active status" do
customer = Factory(:customer, :active => false, :short_name => "test user")
customer1 = Factory.build(:customer, :active => true, :short_name => "Test user")
customer1.should be_valid
end
Run Code Online (Sandbox Code Playgroud)
对short_name的验证是:
validates :short_name, :presence => true, :uniqueness => { :scope => :active }
Run Code Online (Sandbox Code Playgroud)
上面的代码导致错误:
1) Customer data integrity should be OK with duplicate short_name in different active status
Failure/Error: customer = Factory(:customer, :active => false, :short_name => "test …Run Code Online (Sandbox Code Playgroud) 我们的应用程序有一个lease_booking模型,其中包含一个lease_date字段,它是一个数据时间(我们使用sqlite进行开发,使用mysql进行生产).应用程序需要在给定日期找到所有lease_booking.代码如下:
LeaseBooking.where("lease_date == ?", '2012-1-5')
Run Code Online (Sandbox Code Playgroud)
问题是我们在2012/1/5找不到任何lease_booking,因为lease_date是日期+时间格式.应用程序如何仅比较rails 3.1中的数据时间字段的日期部分?
谢谢.
这是渲染的API定义:
render(options = {}, locals = {}, &block)
Returns the result of a render that’s dictated by the options hash. The primary options are:
:partial - See ActionView::Partials.
:file - Renders an explicit template file (this used to be the old default), add :locals to pass in those.
:inline - Renders an inline template similar to how it’s done in the controller.
:text - Renders the text passed in out.
Run Code Online (Sandbox Code Playgroud)
这里没有关于当地人的目的的解释?当地人干什么?
谢谢。
我们的rails 3.1.0应用程序中有rfqs和引用控制器.Rfq有很多报价,引用belongs_to rfq.在routes.rb中,它是:
resources :rfq do
resources :quotes
end
Run Code Online (Sandbox Code Playgroud)
但是我们想列出索引中的所有引号.但预定义路由仅允许显示特定rfq的所有引号,如rake路由所示:
rfq_quotes GET /rfqs/:rfq_id/quotes(.:format) {:action=>"index", :controller=>"quotes"}
Run Code Online (Sandbox Code Playgroud)
添加路线的简单而干净的方法是什么,以便我们可以在索引中列出所有报价,并为列出的每个报价显示和编辑?非常感谢.
还有就是rvm 1.19.6安装在ubuntu 12.04用ruby 2.0.0.permission denied做的时候才接受rvm get stable.这是错误:
$rvm get stable
######################################################################## 100.0%
bash: line 535: /home/ubuntu/.rvm/RELEASE: Permission denied
Could not update RVM, get some help at #rvm IRC channel at freenode servers.
Run Code Online (Sandbox Code Playgroud)
当我们尝试在服务器上安装readline时,rvm remove 2.0.0会创建权限拒绝错误:
$rvm remove 2.0.0
tee: /home/ubuntu/.rvm/log/ruby-2.0.0-p0/1367720906_remove.src.log: Permission denied
tee: /home/ubuntu/.rvm/log/ruby-2.0.0-p0/1367720906_remove.src.log: Permission denied
Removing /home/ubuntu/.rvm/src/ruby-2.0.0-p0...........
.........
Error running '__rvm_rm_rf /home/ubuntu/.rvm/rubies/ruby-2.0.0-p0',
please read /home/ubuntu/.rvm/log/ruby-2.0.0-p0/1367720907_remove.rubies.log
rm: cannot remove `/home/ubuntu/.rvm/bin/ruby-2.0.0-p0': Permission denied
Removing ruby-2.0.0-p0 aliases...
Removing ruby-2.0.0-p0 wrappers... …Run Code Online (Sandbox Code Playgroud) 我们要做的是将一大块erb代码存储在a中string然后执行代码run time.这是我们做的测试:
1. take out a chunk of the code from a working erb file and,
2. rewrite the erb file with eval.
Run Code Online (Sandbox Code Playgroud)
以下是取出的erb代码块:
<tr>
<th>#</th>
<th><%= t('Date') %></th>
<th><%= t('Project Name') %></th>
<th><%= t('Task Name') %></th>
<th><%= t('Log') %></th>
<th><%= t('Entered By') %></th>
</tr>
<% @logs.each do |r| %>
<tr>
<td><%= r.id %></td>
<td><%= (r.created_at + 8.hours).strftime("%Y/%m/%d")%></td>
<td><%= prt(r, 'task.project.name') %></td>
<td><%= prt(r, 'task.task_template.task_definition.name') %></td>
<td><%= prt(r, :log) %></td>
<td><%= prt(r, 'last_updated_by.name') %></td> …Run Code Online (Sandbox Code Playgroud) 我们在rails 3.2 app中使用simple_form 2.0.2.对于某些布尔字段,我们希望在某些情况下使其成为只读,并且不允许更新.这是我们的应用程序中的代码:
<%= f.input :signed, :label => t('Signed'), :as => :boolean, :readonly => readonly?(@project, 'signed') %>
Run Code Online (Sandbox Code Playgroud)
我们发现,如果:readonly => true当鼠标在简单形式的场上时,会出现一个小红圈(圆圈中有一个斜线).但是,仍然可以更改和保存复选框.有没有办法在simple_form上设置布尔复选框只读,不能用以下内容更新:readonly?谢谢.
我们的 Rails 3.2.12 应用程序中有多轨引擎(gem)。当 Rails 引擎有更新时,版本也会更新。然后bundle update engine_name更新引擎。但是bundle update engine_name,当 时,出现ActiveModel不应更新的错误。更新单个 Rails 引擎 gem 的正确方法是什么?
在Windows中,升级到rails时.4.1.0.beta1,bundle install使用gem minitest创建错误:
Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://s3.amazonaws.com/production.s3.r
ubygems.org/gems/minitest-5.2.1.gem)
Run Code Online (Sandbox Code Playgroud)
之前发生过类似的错误,我们通常会尝试安装旧版本.但这次最小的5.2.0有同样的错误.这个错误的原因是什么以及如何解决?