您好我有一个网址,我想匹配uuid网址如下所示:
/ mobile/mobile-thing/68f8ffbb-b715-46fb-90f8-b474d9c57134 /
urlpatterns = patterns("mobile.views",
url(r'^$', 'something_cool', name='cool'),
url(r'^mobile-thing/(?P<uuid>[.*/])$', 'mobile_thing', name='mobile-thinger'),
)
Run Code Online (Sandbox Code Playgroud)
但这根本不起作用.我没有调用我的相应视图.我测试了很多变化...... 啊
但是url(r'^mobile-thing/', 'mobile_thing', name='mobile-thinger')工作就像一个魅力,但没有组...
将应用程序从Rails 2.3.17迁移到3.2.21时..link_to_remote在使用MiniTest进行测试时,我们遇到了Rails遗留表单帮助程序的问题.
在旧版本的rails中,我们使用了在Rails 3中删除的link_to_remote表单助手.为了提供支持,我们在我们的应用程序中添加了prototype_legacy_helper插件,该插件在UI中运行良好,但测试失败并抛出错误,如下所示:
NoMethodError: undefined method `link_to_remote' for #<ApplicationHelperTest:0xc800dd4>
Run Code Online (Sandbox Code Playgroud)
这是我们在ApplicationHelper中的代码
def reservation_menu_command_link(command, *args)
...
command_link = link_to_remote(anchor_text,options = {}, {:class => style_class})
...
end
Run Code Online (Sandbox Code Playgroud)
这是我们对application_helper测试的测试用例
def test_reservation_menu_command_link
options = { :lodging_view => lv}
assert_equal(%q{xyz}, reservation_menu_command_link(:cancel_all_possible, options))
end
Run Code Online (Sandbox Code Playgroud)
所以你可以看到我们有一个方法reservation_menu_command_link,我们在我们的UI中使用它,工作正常,但测试此定义失败.
任何人都可以帮助我摆脱插件的这种行为吗?
这是我的代码:
module Star
def Star.line
puts '*' * 20
end
end
module Dollar
def Star.line
puts '$' * 20
end
end
module At
def line
puts '@' * 20
end
end
include At
Dollar::line # => "@@@@@@@@@@@@@@@@@@@@"
Star::line # => "$$$$$$$$$$$$$$$$$$$$"
Dollar::line # => "@@@@@@@@@@@@@@@@@@@@"
line # => "@@@@@@@@@@@@@@@@@@@@"
Run Code Online (Sandbox Code Playgroud)
谁能解释我是如何得到这个结果的?我不明白这里的方法查找流程.