是的问题是,我创建了一个这样的嵌套资源:
resources :albums do
resources :elements
end
Run Code Online (Sandbox Code Playgroud)
并且rake routes命令显示:
album_element GET /albums/:album_id/elements/:id(.:format) elements#show
Run Code Online (Sandbox Code Playgroud)
所以,当我在... /专辑/ 1时,我可以前往... /专辑/ 1 /元素
这启动了元素控制器的索引操作,就好了.但是,如果我编辑index.html.erb
<%= link_to 'Show', album_element_path %>
Run Code Online (Sandbox Code Playgroud)
我收到这样的错误:
Started GET "/albums/1/elements" for 176.221.47.67 at Tue Oct 09 14:25:39 +0200 2012
Processing by ElementsController#index as HTML
Parameters: {"album_id"=>"1"}
Rendered elements/index.html.erb within layouts/application (9.2ms)
Completed 500 Internal Server Error in 123ms
ActionController::RoutingError (No route matches {:controller=>"elements", :action=>"show"}):
app/views/elements/index.html.erb:29:in `_app_views_elements_index_html_erb___13604879__168097178'
app/views/elements/index.html.erb:18:in `each'
app/views/elements/index.html.erb:18:in `_app_views_elements_index_html_erb___13604879__168097178'
app/controllers/elements_controller.rb:7:in `index'
Run Code Online (Sandbox Code Playgroud)
所以它说没有路线匹配......但实际上我的rake路线显示了吗?我究竟做错了什么 ?
当我使用magentoshop访问页面时; 我收到此错误消息:
在第85行的/xxxxx/app/code/core/Mage/Catalog/Model/Product/Type/Configurable/Price.php中的非对象上调用成员函数getId()
我前往该行,它是一个名为getTotalConfigurableItemsPrice的函数的一部分.这是在一个foreach:
它说:
foreach ($attributes as $attribute) {
$attributeId = $attribute->getProductAttribute()->getId();
Run Code Online (Sandbox Code Playgroud)
而属性的东西是问题.我在$ attribute-> getProductAttribute()上尝试了var_dump()并收到了NULL($ attribute)上的var_dump显示ie
["_data":protected]=>
array(5) {
["product_super_attribute_id"]=>
string(4) "3845"
["product_id"]=>
string(8) "10001563"
["attribute_id"]=>
string(3) "135"
["position"]=>
string(1) "0"
["product_attribute"]=>
NULL
}
Run Code Online (Sandbox Code Playgroud)
该属性有什么问题,我该如何解决?如果我说:
$attributeId = 1234;
Run Code Online (Sandbox Code Playgroud)
代替
$attributeId = $attribute->getProductAttribute()->getId();
Run Code Online (Sandbox Code Playgroud)
错误消失了,但我需要真正的价值观......
嘿伙计我需要存储2个复选框的信息.如果他们被点击了,我需要州.
但我需要把这些信息放到pdict中,因为我需要在另一个网站上.
所以我在jQuery中已经有了一个click()函数,但我需要把结果放到pdict中.
背景:您在一个站点上,可以启用/禁用2个复选框.但是,您必须使用完全不同的管道登录该站点.如果登录成功,我需要在原始管道中返回复选框状态.
attributes ×1
controller ×1
demandware ×1
jquery ×1
magento ×1
nested ×1
resources ×1
routes ×1