小编Ros*_*oss的帖子

FactoryGirl:工厂未注册:user(ArgumentError)

使用FactoryGirl以正确的顺序获取所有鸭子很麻烦.

设置极简主义的rails应用程序(3.0.11),factory_girl_rails(1.4.0),factory_girl(2.3.2)和cucumber-rails(1.2.1)以及ruby-1.8.7-p352.

黄瓜测试是:

Feature: a
  Scenario: test factory-girl
    Given the following user exists:
    | name    | email               |
    | Brandon | brandon@example.com |
Run Code Online (Sandbox Code Playgroud)

结果是这样的:

cucumber 
Using the default profile...
"Adam Advertiser"
"a@b.com"
#<User id: nil, name: nil, created_at: nil, updated_at: nil, email: nil>
Feature: a

  Scenario: test factory-girl        # features/users.feature:2
    Given the following user exists: # factory_girl-2.3.2/lib/factory_girl/step_definitions.rb:100
      | name    | email               |
      | Brandon | brandon@example.com |
      **Factory not registered: user (ArgumentError)**
      features/users.feature:3:in `Given the following user exists:'

Failing Scenarios: …
Run Code Online (Sandbox Code Playgroud)

ruby cucumber factory-bot

15
推荐指数
1
解决办法
2万
查看次数

Rails 4如何查找字符串列的最大长度

要在SQL中查找字符串列的最大长度为:

select max(length(<column>)) from <table>
Run Code Online (Sandbox Code Playgroud)

谁能在Rails 4 activerecord甚至squeel中展示如何做同样的事情?

ruby-on-rails ruby-on-rails-4

4
推荐指数
2
解决办法
2315
查看次数

capistrano在资产上失败:在cap部署中预编译:冷

我正在进行帽子部署:冷

使用以下config/deploy.rb

1 require 'bundler/capistrano'
  2 
  3 set :application, "massiveapp"
  4 
  5 set :scm, :git
  6 
  7 set :repository, "git://github.com/deployingrails/massiveapp.git"
  8 
  9 server "localhost", :web, :app, :db, :primary => true
 10 
 11 ssh_options[:port] = 2222
 12 ssh_options[:keys] = "~/.vagrant.d/insecure_private_key"
 13 
 14 set :user, "vagrant"
 15 set :group, "vagrant"
 16 set :deploy_to, "/var/massiveapp"
 17 set :use_sudo, false
 18 
 19 set :deploy_via, :copy
 20 set :copy_strategy, :export
 21 
 22 namespace :deploy do
 23   task :start do ; end
 24   task :stop do …
Run Code Online (Sandbox Code Playgroud)

capistrano

1
推荐指数
1
解决办法
886
查看次数