我只想指出:我的互联网连接很糟糕.所以我开始推新图像,场景是这样的:
b57ecdb750f2: Pushing [====> ] 43.57MB/473.9MB
9b7e4da6c261: Pushing [==================================================>] 18.94kB
21d523b40367: Pushed
e18c77c6a7b1: Pushing [==================> ] 106.9MB/285.9MB
5ee5be8f332e: Pushed
78a99e283d45: Retrying in 1 second
98b9d6eacb01: Pushing [=========================================> ] 95.06MB/114MB
96e14acce2fd: Retrying in 1 second
787c930753b4: Pushing [==================================================>] 318.3MB/318.3MB
9f17712cba0b: Pushing [=======================> ] 56.9MB/122.6MB
223c0d04a137: Pushing [==================================================>] 45.18MB
fe4c16cbf7a4: Preparing
Run Code Online (Sandbox Code Playgroud)
同时推送所有这些图层只是简单地杀死我的互联网连接,不允许我导航和定位器抵制自己,因为许多这些图层都上传了错误并一次又一次地重新启动.
有没有办法在时间上传单个图层?(顺便说一句,不,改变我的ISP或我糟糕的路由器不是一个选项)
我是有一些问题,宙斯+ rspec的和我找到了解决办法说,我一定要删除require 'rspec/autorun'
的spec_helper.rb
.
这很有效,但我想知道它的用途是rspec/autorun
什么?spec_helper.rb
默认情况下它会出现,但无论有没有,规格都可以使用.
我是新手用Rails 4操纵angularjs,它只提供api.我尝试创建一个简单的角度服务来上传文件.但我使用Paperclip来管理文件,我有一些问题.
首先,我不明白如何正确收集输入文件.我已经看到很多插件或胖指令来做到这一点.但我想要一个简单的指令收集我的文件并放入我的ng模型.
最后我想知道在Base64中编码我的文件是否更有效?
我的Rails控制器
class Api::EmployeesController < Api::BaseController
def create
employee = Employee.create(employee_params)
if employee.save
render json: employee
else
render :json => { :errors => employee.errors.full_messages }, :status => 406
end
end
def employee_params
params.require(:employee).permit(:first_name,:mobile_phone,:file)
end
end
Run Code Online (Sandbox Code Playgroud)
我的Angularjs服务
angular.module('test').factory 'Employee', ($resource, $http) ->
class Employee
constructor: (errorHandler) ->
@service = $resource('/api/employees/:id',
{id: '@id'},
{update: {method: 'PATCH'}})
@errorHandler = errorHandler
create: (attrs, $scope) ->
new @service(employee: attrs).$save ((employee) ->
$scope.employees.push(employee)
$scope.success = true
$timeout (->
$scope.success = false
), 3000 …
Run Code Online (Sandbox Code Playgroud) 我遇到了与此问题相反的问题.该Gemfile
有:
source 'https://rubygems.org'
ruby '2.3.1'
Run Code Online (Sandbox Code Playgroud)
在我的Gemfile.lock
文件的末尾是:
RUBY VERSION
ruby 2.3.1p112
BUNDLED WITH
1.12.4
Run Code Online (Sandbox Code Playgroud)
但是当我运行时bundle install
总是删除,RUBY VERSION
无论我使用的是开发团队的版本.即使我使用的是比用于生成原始Gemfile.lock
文件的更新的Bundler版本:
$ bundle -v
Bundler version 1.12.5
$ ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
Run Code Online (Sandbox Code Playgroud)
任何想法我怎么能阻止这个?
我的Guardfile
rails项目中有一个文件,但只是以纯文本显示,因此每次打开时都必须分配ruby语法才能正确显示它.
我不能使用Open all with current extension as...
,因为它不具有扩展名,但我想我可以分配一个特定的语法文件没有扩展名的文件,因为喜欢Gemfile
,Capfile
还是Rakefile
能正确显示.我怎样才能做到这一点?
当我尝试将网站更新到 Ruby 3.0.0 时,出现以下错误:
ArgumentError(参数数量错误(给定 2,预期 1))
% rails console
Loading development environment (Rails 6.1.0)
irb(main):001:0> puts RUBY_VERSION
3.0.0
irb(main):002:0> puts IceCube::VERSION
0.16.3
irb(main):003:0> schedule = IceCube::Schedule.new
=> #<IceCube::Schedule:0x00007fccfe19cfa8 @start_time=2020-12-27 11:14:30 -0800, @all_recurrence_rules=[], @all_exception_rules=[]>
irb(main):004:0> puts schedule.to_ical
Traceback (most recent call last):
1: from (irb):4:in `<main>'
ArgumentError (wrong number of arguments (given 2, expected 1))
Run Code Online (Sandbox Code Playgroud)
以下是与 Ruby 2.7.2 相同的命令
% rails console
Loading development environment (Rails 6.1.0)
irb(main):001:0> puts RUBY_VERSION
2.7.2
irb(main):002:0> puts IceCube::VERSION
0.16.3
irb(main):003:0> schedule = IceCube::Schedule.new
=> …
Run Code Online (Sandbox Code Playgroud) 一个基本的问题,但是我在项目页面或Wiki中找不到清晰的内容。我有以下代码:
field = "secre"
Position.search( {:description_cont => field, :code_cont => field}).result(:distinct => true).to_sql
=> "SELECT DISTINCT `positions`.* FROM `positions` WHERE ((`positions`.`description` LIKE '%secre%' AND `positions`.`code` LIKE 0))"
Run Code Online (Sandbox Code Playgroud)
但是我的查询应该是这样的:
=> "SELECT DISTINCT `positions`.* FROM `positions` WHERE ((`positions`.`description` LIKE '%secre%' OR `positions`.`code` LIKE 0))"
Run Code Online (Sandbox Code Playgroud)
任何帮助,将不胜感激。提前致谢
我使用rake 10.0.4并且我已经升级到10.1.0,但现在当我部署到我的登台服务器时它会抛出我:
rake aborted!
undefined method `push' for LL("db"):Rake::Scope
/home/alter/.rvm/gems/ruby-1.9.3-p429@3.2.13/gems/seedbank-0.1.3/lib/seedbank/dsl.rb:11:in `override_task'
/home/alter/.rvm/gems/ruby-1.9.3-p429@3.2.13/gems/seedbank-0.1.3/lib/tasks/seed.rake:42:in `block in <top (required)>'
/home/alter/.rvm/gems/ruby-1.9.3-p429@3.2.13/gems/seedbank-0.1.3/lib/tasks/seed.rake:1:in `<top (required)>'
/home/alter/.rvm/gems/ruby-1.9.3-p429@3.2.13/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `load'
/home/alter/.rvm/gems/ruby-1.9.3-p429@3.2.13/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `block in load'
/home/alter/.rvm/gems/ruby-1.9.3-p429@3.2.13/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
/home/alter/.rvm/gems/ruby-1.9.3-p429@3.2.13/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `load'
/home/alter/.rvm/gems/ruby-1.9.3-p429@3.2.13/gems/seedbank-0.1.3/lib/seedbank.rb:19:in `block in load_tasks'
/home/alter/.rvm/gems/ruby-1.9.3-p429@3.2.13/gems/seedbank-0.1.3/lib/seedbank.rb:19:in `each'
/home/alter/.rvm/gems/ruby-1.9.3-p429@3.2.13/gems/seedbank-0.1.3/lib/seedbank.rb:19:in `load_tasks'
/home/alter/.rvm/gems/ruby-1.9.3-p429@3.2.13/gems/seedbank-0.1.3/lib/seedbank/railtie.rb:9:in `block in <class:Railtie>'
/home/alter/.rvm/gems/ruby-1.9.3-p429@3.2.13/gems/railties-3.2.13/lib/rails/railtie.rb:184:in `instance_exec'
/home/alter/.rvm/gems/ruby-1.9.3-p429@3.2.13/gems/railties-3.2.13/lib/rails/railtie.rb:184:in `block in load_tasks'
/home/alter/.rvm/gems/ruby-1.9.3-p429@3.2.13/gems/railties-3.2.13/lib/rails/railtie.rb:184:in `each'
/home/alter/.rvm/gems/ruby-1.9.3-p429@3.2.13/gems/railties-3.2.13/lib/rails/railtie.rb:184:in `load_tasks'
/home/alter/.rvm/gems/ruby-1.9.3-p429@3.2.13/gems/railties-3.2.13/lib/rails/engine.rb:423:in `block in load_tasks'
/home/alter/.rvm/gems/ruby-1.9.3-p429@3.2.13/gems/railties-3.2.13/lib/rails/application/railties.rb:8:in `each'
/home/alter/.rvm/gems/ruby-1.9.3-p429@3.2.13/gems/railties-3.2.13/lib/rails/application/railties.rb:8:in `all'
/home/alter/.rvm/gems/ruby-1.9.3-p429@3.2.13/gems/railties-3.2.13/lib/rails/engine.rb:423:in `load_tasks'
/home/alter/.rvm/gems/ruby-1.9.3-p429@3.2.13/gems/railties-3.2.13/lib/rails/application.rb:145:in `load_tasks'
/home/alter/.rvm/gems/ruby-1.9.3-p429@3.2.13/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
/home/alter/workspace/MyApp/Rakefile:7:in `<top (required)>'
/home/alter/.rvm/gems/ruby-1.9.3-p429@3.2.13/bin/ruby_noexec_wrapper:14:in `eval'
/home/alter/.rvm/gems/ruby-1.9.3-p429@3.2.13/bin/ruby_noexec_wrapper:14:in `<main>'
(See full trace by running task with --trace) …
Run Code Online (Sandbox Code Playgroud) 我想从 TDD 开始,但我遇到了这个错误,我正在使用 rvm - ruby 3.0.0 和 Rails 6.1.1
An error occurred while loading ./spec/models/user_spec.rb. - Did you mean?
rspec ./spec/spec_helper.rb
Failure/Error: require File.expand_path('../config/environment', __dir__)
LoadError:
cannot load such file -- rexml/document
/home/manci/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:34:in `require'
/home/manci/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.1/lib/active_support/dependencies.rb:332:in `block in require'
/home/manci/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.1/lib/active_support/dependencies.rb:332:in `require'
/home/manci/.rvm/gems/ruby-3.0.0/gems/selenium-webdriver-3.142.7/lib/selenium/webdriver/firefox.rb:22:in `<main>'
/home/manci/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
Run Code Online (Sandbox Code Playgroud)
如何解决这个问题?
I am new to Ruby on Rails and maybe this is a very trivial issue, but I searched online for a solution and all of them are at least 2-3 years old and they described the same thing. All the tutorials and videos I watched, said to create a new app with webpack for React, using:
\nrails new app_name --webpack=react -d=postgresql -T\n
Run Code Online (Sandbox Code Playgroud)\nEverybody said, that this command will create a pack folder under my app/javascript folder like this: …
ruby ×4
rspec ×2
rspec-rails ×2
angularjs ×1
bundler ×1
docker ×1
file-upload ×1
javascript ×1
paperclip ×1
rake ×1
ransack ×1
reactjs ×1
ruby-3 ×1
sublimetext2 ×1