小编use*_*483的帖子

rails active admin deployment:找不到文件'jquery-ui'

当尝试使用capistrano进行部署时,capistrano使用命令bundle exec rake

    RAILS_ENV=production 
    RAILS_GROUPS=assets 
    assets:precompile
Run Code Online (Sandbox Code Playgroud)

我有这个错误

couldn't find file 'jquery-ui'
  (in /home/umbrosus/.rvm/gems/ruby-1.9.3-p392@gancxadebebi/gems/activeadmin-0.5.1/app/assets/javascripts/active_admin/base.js:2)
Run Code Online (Sandbox Code Playgroud)

在它运行良好之前,但我尝试更新到0.6然后我开始出现此错误.我回到0.5.1,错误仍然存​​在.我做坏事吗?

谢谢

capistrano assets ruby-on-rails activeadmin

43
推荐指数
3
解决办法
2万
查看次数

具有设计的表用户的自定义table_name

对于我的应用程序,我有几个用户表(franceusers,belgiumusers,...),我想使用一个或另一个取决于我尝试使用table_name_prefix和table_name的域,但它似乎不起作用

class User < ActiveRecord::Base
rolify
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable,
# :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable, #:confirmable,
:recoverable, :rememberable, :trackable, :validatable

def self.table_name
debugger
'franceusers'
end

def self.table_name_prefix
debugger
'france'
end
end
Run Code Online (Sandbox Code Playgroud)

多亏了调试器,我可以看到它被调用但不是self.table_name_prefix.即使调用了self.table_name,也要在表用户而不是franceusers中设计搜索用户

在控制台User.table_name =>"franceusers"

User.table_name_prefix =>"france"

更奇怪的是,我也使用activeadmin,当我浏览用户列表时,我有一个错误:Mysql2 ::错误:'order clause'中的未知列'franceusers.id':SELECT users.*FROM users ORDER BY franceusers.id desc限制30 OFFSET 0

它似乎可以为字段找到table_prefix但不能为FROM找到.

我做坏事吗?是否有另一种方法来更改用户表名?我不能将所有用户表连接成一个,因为它是我老板的指令:-s

谢谢

ruby-on-rails devise

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

为什么我的工作在测试期间没有执行?

这是我的代码的一个小描述(简化)

应用程序/工作/

class GenerateInvoiceJob < ActiveJob::Base
  queue_as :default

  def perform()
    Invoice.create
  end
end
Run Code Online (Sandbox Code Playgroud)

应用程序/模型/

class Product < ActiveRecord::Base
  def buy
    GenerateInvoiceJob.perform_later
  end
end
Run Code Online (Sandbox Code Playgroud)

规格/工作

RSpec.describe AnotherJob, type: :job do

  context "with filter" do
    ...
  end
end
Run Code Online (Sandbox Code Playgroud)

规格/型号

RSpec.describe Product, type: :model do


    describe '#buy' do
      it "should generate invoice" do
        Product.create().buy

        expect(Invoice.all.size).to eq 1
      end
    end
end
Run Code Online (Sandbox Code Playgroud)

带导轨 4.2.11

当我跑步时

rspec 规格/模型/product_spec.rb

然后测试就可以了(工作已执行)

当我跑步时

rspec spec -e '应生成发票'

然后测试失败,导致作业未执行

如果我从规范/作业中删除所有测试作业然后运行

rspec spec -e '应生成发票'

然后测试就可以了(工作已执行)

我不明白为什么对某些工作进行测试会阻止其他工作的执行?有解决办法吗?

带导轨 5 和导轨 6 …

rspec ruby-on-rails ruby-on-rails-4 ruby-on-rails-5

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