Skip to content

Instantly share code, notes, and snippets.

View liwh's full-sized avatar
🎯
Focusing

robie lee liwh

🎯
Focusing
View GitHub Profile
when we use the plugin act_as_ferret,got the exception
EOFError in 'DestroysController save destroy require reason'
End-of-File Error occured at <except.c>:117 in xpop_context
Error occured in store.c:216 - is_refill
current pos = 0, file length = 0
we should do this :
script/console test
>> MyModel.rebuild_index
app/models/department_duties.rb
class DepartmentDuties < ActiveRecord::Base
include UuidHelper
index :id
belongs_to :department, :class_name => "Department"
#创建人,修改人
belongs_to :creator, :class_name => "User"
belongs_to :modifier, :class_name => "User"
end
Fetching source index for http://rubygems.org/
fatal: Needed a single revision
Updating git://github.com/saberma/acts_as_list_mongoid.git
fatal: Failed to resolve '55e2342' as a valid ref.
An error has occurred in git when running `git reset --hard 55e2342. Cannot complete bundling.
Sometimes,when we remove some gem,but got some error like this:
gem uninstall ***
ERROR: While executing gem ... (NoMethodError)
undefined method `name' for nil:NilClass
This is a error in gem 1.3.4. so we should update the gem version.we should update the gem version to 1.3.5 to correct the problem.
gem install rubygems-update -v 1.3.5
update_rubygems --no-ri --no-rdoc
今天,遇到一个问题,就是在某些ie下,点击某些链接的时候,ie会自动关闭,开始不知道原因的所在,后来,经过一步步的遮盖代码定位到了问题出现的地方,这是由于,在javascript代码中,某些函数通过document.getElementId("some id"),但是页面中,不存在对应的id,所以造成这种情况
今天,在启动 mysql 进程的时候,sudo /etc/init.d/mysql restart
发生如下问题:/etc/init.d/mysql[19729]: ERROR: The partition with /var/lib/mysql is too full!
后来发现,原来用df 命令,发现,原来是磁盘满了导致的

今天,对多个实体查询去重,发现直接用uniq就可以了,如:
Conversation.search(:params[:search]).uniq.paginate
就行了,而且有分页的效果,但是:查看后台日志中的sql语句,并没有看到其产生limit语句。为什么却实现了分页?

重新更新了一次cucumber,发现在定义step的时候,还不能带空格了。如:
那么 /我能看到:(.+)/ do |text|
response.should contain(text)
end

定义行为为:
那么 我能看到: 某某某
会报错
而 把空格去掉就对了。。

1.验证字段的时候,如果允许为空值得加上:allow_nil => true,如:

:validates_length_of :content,:maxinum => 200
#直接用modelname.create(:content=> nil)会出错,得加上:allow_nil => true

2.fixtures里面,如果某字段值设置为ture,在mysql 里显示的是1

>> ActionWebService
=> ActionWebService
>> ActionWebService::Dispatcher
=> ActionWebService::Dispatcher
>> ActionWebService::Dispatcher::ActionController
=> ActionWebService::Dispatcher::ActionController
>> ActionWebService::Dispatcher::ActionController::Base
NameError: uninitialized constant ActionWebService::Dispatcher::ActionController::Base
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:443:in `load_missing_constant'
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:80:in `rake_original_const_missing'