请帮我解决水豚这个问题
我在水豚中有一个这样的按钮:
<input type="submit" value="Verify" name="verify" id="verify" class="button">
Run Code Online (Sandbox Code Playgroud)
我试过了
click_button "verify"
但它给出了错误:
Failure/Error: find('#verify').click
NoMethodError:
undefined method `node_name' for nil:NilClass
Run Code Online (Sandbox Code Playgroud) 基本上我有一个initializer class
atRAILS_ROOT/config/initialiers/app_constant.rb
来让一切变得容易控制。
class AppConstant
APIURL = 'http://path.to.api'
end
Run Code Online (Sandbox Code Playgroud)
在 中RAILS_ROOT/model/user.rb
,我有设置:
class User < ActiveResource::Base
self.site = AppConstant::APIURL
end
Run Code Online (Sandbox Code Playgroud)
当运行时rails s
,我收到以下错误
<class:User>: uninitialized constant User::AppConstant::APIURL
Run Code Online (Sandbox Code Playgroud)
我知道问题是因为 Rails 在创建类后运行初始化程序。有没有办法让一些初始化器在 Rails 设置它的类之前运行?
require "#{Rails.root}\conf\initializers\app_constant.rb"
最后,通过添加application.rb
在 Rails 加载模型之前加载的 来解决这个问题。
HTML
<div class="whole">
<div class="fst"></div>
<div class="sec"></div>
<div class="thd"></div>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS
.whole {
width: 100%;
height: 20px;
}
.whole div {
height: 20px;
display: inline-block;
position: relative;
}
.fst {
float: left;
width: 20px;
background: blue;
}
.sec {
background: red;
}
.thd {
float: right;
width: 20px;
background: blue;
}
Run Code Online (Sandbox Code Playgroud)
有没有办法拉伸div.sec
适合左边div.fst
和div.thd
任何屏幕尺寸的区域?像素的宽度div.fst
和div.thd
固定.
有没有只有css的解决方案?
非常感谢您的帮助!
请参阅我的fiddle
http://jsfiddle.net/vHHcf/