是否有一种性感的方式来获得一个带有谷歌地图的网页(全屏),顶部只有一个小div#标题,中间有一个小div#容器?
我做了一些研究,我找到了这个例子:http://koti.mbnet.fi/ojalesa/exam/index.html ...但这不是我想做的.
如果你有一个很好的网站示例的瘦代码示例,这将帮助我很多.
非常感谢.
如何覆盖def方法?但这很奇怪,因为我不知道def方法的定义.它不是Module,不是Object,不是BasicObject(Ruby 1.9).并且def.class什么都不说;)
我想使用类似的东西:
sub_def hello
puts "Hello!"
super
end
def hello
puts "cruel world."
end
# ...and maybe it could print:
# => "Hello!"
# => "cruel world."
Run Code Online (Sandbox Code Playgroud)
非常感谢,任何想法.
我在使用Ruby块时遇到一些困难,传入一个方法.
在下面的例子中,我想从Box实例中显示@array的每个元素(使用.each方法):
class Box
def initialize
@array = [:foo, :bar]
end
def each(&block)
# well, hm..
end
end
a = Box.new
a.each { |element| puts element }
Run Code Online (Sandbox Code Playgroud) 我想使用Authlogic与已登录用户编写一些单元测试.首先,我使用了http://github.com/binarylogic/authlogic_example中托管的一些代码.但是我在rake测试后得到一个错误,因为"test_helper.rb"和下面的类:
class ActionController::TestCase
setup :activate_authlogic
end
Run Code Online (Sandbox Code Playgroud)
这是我的错误:
NameError:未定义的局部变量或方法`activate_authlogic'for
我认为这个Authlogic示例映射在Rails 2上; 也许它在Rails 3上有点不同.是否有另一个例子我可以举例说明单元测试?
非常感谢.
ruby ×2
authlogic ×1
class ×1
css ×1
google-maps ×1
html ×1
methods ×1
object ×1
unit-testing ×1