开发者

Ruby on Rails 3

Learning Ruby on rails from Michael Hartl I am following the book and have come across a problem when inserting an image, the error that is produced is here

SyntaxError in Pages#home

Showing /Users/richardhardesty/Sites/rails_projects/beginning/app/views/layouts/application.html.erb where line #17 raised:

/Users/richardhardesty/Sites/rails_projects/beginning/app/views/layouts/application.html.erb:17: syntax error, unexpected ':', expecting ')'
...pend= ( image_tag('logo.png'  :alt =>'Sample App'  :class =>...
...                               ^
/Users/richardhardesty/Sites/rails_projects/beginning/app/views/layouts/application.html.erb:17: syntax error, unexpected ':', expecting ')'
...go.png'  :alt =>'开发者_高级运维Sample App'  :class =>"round" ) );@output_b...
...                               ^
/Users/richardhardesty/Sites/rails_projects/beginning/app/views/layouts/application.html.erb:17: syntax error, unexpected ')', expecting keyword_end
...mple App'  :class =>"round" ) );@output_buffer.safe_concat('
...                               ^

Extracted source (around line #17):

14:     <body>
15:         <div class="container">
16:             <header>
17:                 <%= image_tag('logo.png'  :alt =>'Sample App'  :class =>"round" ) %>
18:             <nav class="round">
19:                 <ul>
20:                     <li><%= link_to "Home", '#' %></li>

Trace of template inclusion: app/views/layouts/application.html.erb

I have tried altering the the quotes and brckets and different errors are listed but the problem doesn't go away. Any help would be great thanks.


You need commas between the arguments in the image_tag method:

 <%= image_tag('logo.png', :alt =>'Sample App', :class =>"round" ) %>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜