开发者

Haml rendering error on production

I'm writing a Rails 3 application on Mac OSX and it runs fine under both development and production. When I deploy the app with Passenger I get a error in one of my views. This is how the view looks like:

%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"

And this is the error I'm getting:

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开发者_如何学Go: #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'

Is there something obvious I'm doing wrong?

Regards, Johann


It looks like line #4 is using the new Ruby 1.9 hash syntax of key: value instead of :key => value. Is your production environment running Ruby 1.8? If so, you'll either need to upgrade to 1.9, or use the Ruby 1.8 compatible format:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜