我正在将此添加到.gitignore文件中
.idea/*
Run Code Online (Sandbox Code Playgroud)
但无论如何,状态是:
# modified: .gitignore
# modified: .idea/.generators
# modified: .idea/dovezu.iml
# modified: .idea/misc.xml
# modified: .idea/workspace.xml
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么 ?我甚至将.idea/*添加到全局〜/ .gitignore_global 但git状态,无论如何向我显示:
# modified: .gitignore
# modified: .idea/.generators
# modified: .idea/dovezu.iml
# modified: .idea/misc.xml
# modified: .idea/workspace.xml
Run Code Online (Sandbox Code Playgroud) 当我跑
ffmpeg -y -i test.mov -threads 8 -f webm -aspect 16:9 -vcodec libvpx -deinterlace -g 120 -level 216 -profile 0 -qmax 42 -qmin 10 -rc_buf_aggressivity 0.95 -vb 2M -acodec libvorbis -aq 90 -ac 2 OUTPUT_FILE.webm
Run Code Online (Sandbox Code Playgroud)
它返回错误说 Unknown encoder 'libvpx'
我通过macports安装了libvpx,libvorbis,libogg和ffmpeg
让我们说昨天我在我的主分支上做了一些更改,我忘了添加,提交它们.在早上我做到了
git reset --hard
Run Code Online (Sandbox Code Playgroud)
在这种情况下可以恢复已删除的文件吗?
谁能告诉我rspec,水豚和黄瓜之间的区别?
group :development, :test do
gem 'rspec-rails', '~> 2.0'
end
group :test do
gem 'capybara', '~>2.1.0'
end
Run Code Online (Sandbox Code Playgroud)
在JavaScript中,我将Jasmine视为我的单元测试框架.这三个宝石在Ruby环境中做了什么?
我的模型有default_scope(:order =>'created_at')我的测试(rspec,factory girl,shoulda等)是:
require 'spec/spec_helper.rb'
describe CatMembership do
context "is valid" do
subject { Factory.build(:cat_membership) }
it { should be_valid }
it { should belong_to :cat}
it { should belong_to :cat_group}
it { should have_db_column(:start_date)}
it { should have_db_column(:end_date)}
end
end
Run Code Online (Sandbox Code Playgroud) 让我说我有这个数组:
array = ["str1", "str2", "str3", "str4", "str5", "str6", "str7", "str8"]
Run Code Online (Sandbox Code Playgroud)
我在做什么:
array.delete_if {|i| i == "str1" || i == "str3" || i == "str5"}
Run Code Online (Sandbox Code Playgroud)
我有:
["str2", "str4", "str6", "str7", "str8"]
Run Code Online (Sandbox Code Playgroud)
有什么更好的办法在红宝石做这个?
我有一个非常奇怪的rspec情况.我试图测试我的函数是否正确处理异常.以下是我的代码:
在User.rb中:
def welcome_user
begin
send_welcome_mail(self)
rescue Exception => exception
ErrorMessage.add(exception, user_id: self.id)
end
end
end
Run Code Online (Sandbox Code Playgroud)
在user_spec.rb中
it "adds to error message if an exception is thrown" do
mock_user = User.new
mock_user.stub(:send_welcome_mail).and_raise(Exception)
ErrorMessage.should_receive(:add)
mock_user.welcome_user
end
Run Code Online (Sandbox Code Playgroud)
测试通过了,但是当我改变ErrorMessage.should_receive(:add)时ErrorMessage.should_not_receive(:add),它也通过了任何见解?
我使用rails generate devise user创建了一个模型用户,然后rake db:migrate然后rake路由.一旦我这样做,我知道我的家庭索引中的错误是一个动作控制器异常.他说:
undefined method `devise_for' for #< ActionDispatch::Routing::Mapper:0x105371120>
Run Code Online (Sandbox Code Playgroud)
我的完整痕迹是:
config/routes.rb:2
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:233:in `instance_exec'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:233:in `draw'
config/routes.rb:1
activesupport (3.0.3) lib/active_support/dependencies.rb:235:in `load'
activesupport (3.0.3) lib/active_support/dependencies.rb:235:in `load'
activesupport (3.0.3) lib/active_support/dependencies.rb:225:in `load_dependency'
activesupport (3.0.3) lib/active_support/dependencies.rb:596:in `new_constants_in'
activesupport (3.0.3) lib/active_support/dependencies.rb:225:in `load_dependency'
activesupport (3.0.3) lib/active_support/dependencies.rb:235:in `load'
railties (3.0.3) lib/rails/application.rb:127:in `reload_routes!'
railties (3.0.3) lib/rails/application.rb:127:in `each'
railties (3.0.3) lib/rails/application.rb:127:in `reload_routes!'
railties (3.0.3) lib/rails/application.rb:120:in `routes_reloader'
activesupport (3.0.3) lib/active_support/file_update_checker.rb:32:in `call'
activesupport (3.0.3) lib/active_support/file_update_checker.rb:32:in `execute_if_updated'
railties (3.0.3) lib/rails/application/finisher.rb:51:in `_callback_before_5'
activesupport (3.0.3) lib/active_support/callbacks.rb:419:in `_run_prepare_callbacks'
actionpack (3.0.3) …Run Code Online (Sandbox Code Playgroud) 我有2个控制器:
app/
/controllers
posts_controllers.rb
/mobile
posts_controllers.rb
Run Code Online (Sandbox Code Playgroud)
和我的routes.rb看起来像这样:
root :to => "posts#index"
resources :posts
namespace :mobile do
root :to => "posts#index"
resources :posts
end
Run Code Online (Sandbox Code Playgroud)
但是当我访问时/mobile,无论如何渲染第一个控制器的索引页面,也尝试了这个:
namespace :mobile do
root :to => "mobile/posts#index"
resources :posts
end
Run Code Online (Sandbox Code Playgroud)
但它给了我错误:uninitialized constant Mobile::Mobile
我想渲染第二个控制器的索引页面,我该怎么做?
编辑
通过输入/ mobile我想渲染位于此处的文件:
app/
views/
/mobile
/posts
index.html.erb
Run Code Online (Sandbox Code Playgroud)
但它在这里是rending文件:
app/
views/
/posts
index.html.erb
Run Code Online (Sandbox Code Playgroud) 我刚用DocuSign创建了我的开发者帐户,显然我需要在我的api调用中添加一个"Integrator Key",我在哪里可以获得一个?我必须联系DocuSign吗?