2011-09-10 72 views
1

我正在Mac OSX上编写Rails 3应用程序,它在开发和生产环境下运行良好。当我使用Passenger部署应用程序时,在我的某个视图中出现错误。这是该视图的样子:Haml渲染生产出错

%p#refresh= link_to 'Refresh', '#', id: "refreshAreaLink" 

#newAreaParagraph 
    = link_to 'New area', '#', id: "createNewAreaLink" 

- for area_group in AreaGroup.all 
    .areaGroup 
    = area_group.name 
    %ul 
    - for area in Area.find_all_by_area_group_id(area_group.id) 
    %li.areaList 
     = link_to area.name, area, :remote => true, :class => "areaLink", :id => "prufa" 
.areaGroup 
    No group 
- for area in Area.find_all_by_area_group_id(nil) 
    %li.areaList 
    = link_to area.name, area, :remote => true, :class => "areaLink", :id => "prufa" 

这是我得到的错误:

Started GET "/" for 192.168.102.28 at Sat Sep 10 15:36:20 +0000 2011 
    Processing by MapController#index as HTML 
Rendered areas/_sidebar.html.haml (4.9ms) 
Rendered map/index.html.haml within layouts/map (7.8ms) 
Completed in 224ms 

ActionView::Template::Error (compile error 
/var/shellopt/app/views/areas/_sidebar.html.haml:1: syntax error, unexpected ':', expecting ')' 
...e((link_to 'Refresh', '#', id: "refreshAreaLink" 
          ^
/var/shellopt/app/views/areas/_sidebar.html.haml:4: syntax error, unexpected ':', expecting ')' 
...(link_to 'New area', '#', id: "createNewAreaLink" 
           ^): 
    1: %p#refresh= link_to 'Refresh', '#', id: "refreshAreaLink" 
    2: 
    3: #newAreaParagraph 
    4: = link_to 'New area', '#', id: "createNewAreaLink" 
    app/views/areas/_sidebar.html.haml:22:in `compile' 
    app/views/layouts/map.html.haml:24:in `_app_views_layouts_map_html_haml___245337611_70182228267100_0' 

有什么明显的,我做错了什么?

问候, 约翰

回答

2

它看起来像4号线使用的key: value代替:key => value新的Ruby 1.9的哈希语法。您的生产环境是否运行Ruby 1.8?如果是这样,你需要升级到1.9,或者使用Ruby 1.8兼容格式:

= link_to 'New area', '#', :id => "createNewAreaLink" 
+0

正确 - 我在生产中使用1.8.x, 。对我来说,下一步是更新生产中的红宝石版本。非常感谢Dylan。 – gugguson