# Syntax error, unexpected keyword\_ensure

**URL:** <https://www.ruby-forum.com/t/syntax-error-unexpected-keyword-ensure/192972>\
**Category:** IT\
**Created:** [August 9, 2010, 12:10pm UTC](https://www.ruby-forum.com/t/syntax-error-unexpected-keyword-ensure/192972 "2010-08-09T12:10:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![punkaruby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/49beb7/32.png) [@punkaruby](https://www.ruby-forum.com/u/punkaruby)\
**Post date:** [August 9, 2010, 12:10pm UTC](https://www.ruby-forum.com/t/syntax-error-unexpected-keyword-ensure/192972/1 "2010-08-09T12:10:31Z")

</div>

Ciao a tutti,  
mi farebbe assai comodo capire dove sta l’errore:

in una mia view ho impostato questo codice:

\<% @atts.each do |att| %\>  
\<% pathFile = Attachment::EXTENDEDPATH + att.idext.to\_s %\>_\<%  
att.categoria %\>_\<% att.nome %\>\_\<% att.nomeoriginale %\>

- \<%=h att.didascalia %\>, \<%=h att.nomeoriginale%\>&nbsp;&nbsp;&nbsp; \<% form\_tag :controller =\> 'attachments', :action =\> 'download' %\> \<% hidden\_field\_tag 'path\_to\_file', :value =\> pathFile %\> \<%= submit\_tag 'SCARICA', :id =\> "search-submit-attach" %\> \<% end %\> &nbsp;&nbsp;&nbsp; \<%= link\_to image\_tag("delete.gif", :border=\>0), att, :confirm =\> 'Sicuri ?', :method =\> :delete %\>
\<% end %\>

ma vengo bastonato:

SyntaxError in Resources#show

Showing app/views/shared/\_mostrattach.html.erb where line #11 raised:

F:/rubyProjects/fg/app/views/shared/\_mostrattach.html.erb:11: syntax  
error, unexpected keyword\_ensure, expecting $end

Extracted source (around line #11):

8: &nbsp;&nbsp;&nbsp; \<%= link\_to image\_tag(“delete.gif”, :border=\>0),  
att, :confirm =\> ‘Sicuri ?’, :method =\> :delete %\>  
9: \<% end %\>  
10:

Trace of template inclusion: app/views/shared/\_mostrattach.html.erb,  
app/views/resources/show.html.erb

RAILS\_ROOT: F:/rubyProjects/fg  
Application Trace | Framework Trace | Full Trace

F:/rubyProjects/fg/vendor/rails/actionpack/lib/action\_view/renderable.rb:91:in  
`module_eval' F:/rubyProjects/fg/vendor/rails/actionpack/lib/action_view/renderable.rb:91:in`compile!’  
F:/rubyProjects/fg/vendor/rails/actionpack/lib/action\_view/renderable.rb:61:in  
`compile' F:/rubyProjects/fg/vendor/rails/actionpack/lib/action_view/renderable.rb:28:in`render’  
F:/rubyProjects/fg/vendor/rails/actionpack/lib/action\_view/renderable\_partial.rb:20:in  
`block in render' F:/rubyProjects/fg/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:26:in`block in benchmark’  
F:/rubyProjects/fg/vendor/rails/activesupport/lib/active\_support/core\_ext/benchmark.rb:17:in  
`block in ms' C:/Ruby191/lib/ruby/1.9.1/benchmark.rb:309:in`realtime’  
F:/rubyProjects/fg/vendor/rails/activesupport/lib/active\_support/core\_ext/benchmark.rb:17:in  
`ms' F:/rubyProjects/fg/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:26:in`benchmark’  
F:/rubyProjects/fg/vendor/rails/actionpack/lib/action\_view/renderable\_partial.rb:19:in  
`render' F:/rubyProjects/fg/vendor/rails/actionpack/lib/action_view/template.rb:205:in`render\_template’  
F:/rubyProjects/fg/vendor/rails/actionpack/lib/action\_view/renderable\_partial.rb:44:in  
`render_partial' F:/rubyProjects/fg/vendor/rails/actionpack/lib/action_view/partials.rb:184:in`render\_partial’  
F:/rubyProjects/fg/vendor/rails/actionpack/lib/action\_view/base.rb:267:in  
`render' F:/rubyProjects/fg/app/views/resources/show.html.erb:20:in`\_run\_erb\_app47views47resources47show46html46erb’  
F:/rubyProjects/fg/vendor/rails/actionpack/lib/action\_view/renderable.rb:34:in  
`block in render' F:/rubyProjects/fg/vendor/rails/actionpack/lib/action_view/base.rb:306:in`with\_template’  
F:/rubyProjects/fg/vendor/rails/actionpack/lib/action\_view/renderable.rb:30:in  
`render' F:/rubyProjects/fg/vendor/rails/actionpack/lib/action_view/template.rb:205:in`render\_template’  
F:/rubyProjects/fg/vendor/rails/actionpack/lib/action\_view/base.rb:265:in  
`render' F:/rubyProjects/fg/vendor/rails/actionpack/lib/action_view/base.rb:348:in`\_render\_with\_layout’  
F:/rubyProjects/fg/vendor/rails/actionpack/lib/action\_view/base.rb:262:in  
`render' F:/rubyProjects/fg/vendor/rails/actionpack/lib/action_controller/base.rb:1250:in`render\_for\_file’  
F:/rubyProjects/fg/vendor/rails/actionpack/lib/action\_controller/base.rb:942:in  
`render' F:/rubyProjects/fg/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:51:in`block in render\_with\_benchmark’  
F:/rubyProjects/fg/vendor/rails/activesupport/lib/active\_support/core\_ext/benchmark.rb:17:in  
`block in ms' C:/Ruby191/lib/ruby/1.9.1/benchmark.rb:309:in`realtime’  
F:/rubyProjects/fg/vendor/rails/activesupport/lib/active\_support/core\_ext/benchmark.rb:17:in  
`ms' F:/rubyProjects/fg/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:51:in`render\_with\_benchmark’  
F:/rubyProjects/fg/vendor/rails/actionpack/lib/action\_controller/mime\_responds.rb:135:in  
`block in custom' F:/rubyProjects/fg/vendor/rails/actionpack/lib/action_controller/mime_responds.rb:179:in`call’  
F:/rubyProjects/fg/vendor/rails/actionpack/lib/action\_controller/mime\_responds.rb:179:in  
`block in respond' F:/rubyProjects/fg/vendor/rails/actionpack/lib/action_controller/mime_responds.rb:173:in`each’  
F:/rubyProjects/fg/vendor/rails/actionpack/lib/action\_controller/mime\_responds.rb:173:in  
`respond' F:/rubyProjects/fg/vendor/rails/actionpack/lib/action_controller/mime_responds.rb:107:in`respond\_to’  
F:/rubyProjects/fg/app/controllers/resources\_controller.rb:16:in `show' F:/rubyProjects/fg/vendor/rails/actionpack/lib/action_controller/base.rb:1331:in`perform\_action’  
F:/rubyProjects/fg/vendor/rails/actionpack/lib/action\_controller/filters.rb:617:in  
`call_filters' F:/rubyProjects/fg/vendor/rails/actionpack/lib/action_controller/filters.rb:610:in`perform\_action\_with\_filters’  
F:/rubyProjects/fg/vendor/rails/actionpack/lib/action\_controller/benchmarking.rb:68:in  
`block in perform_action_with_benchmark' F:/rubyProjects/fg/vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:17:in`block in ms’  
C:/Ruby191/lib/ruby/1.9.1/benchmark.rb:309:in `realtime' F:/rubyProjects/fg/vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:17:in`ms’  
F:/rubyProjects/fg/vendor/rails/actionpack/lib/action\_controller/benchmarking.rb:68:in  
`perform_action_with_benchmark' F:/rubyProjects/fg/vendor/rails/actionpack/lib/action_controller/rescue.rb:160:in`perform\_action\_with\_rescue’  
F:/rubyProjects/fg/vendor/rails/actionpack/lib/action\_controller/flash.rb:151:in  
`perform_action_with_flash' F:/rubyProjects/fg/vendor/rails/actionpack/lib/action_controller/base.rb:532:in`process’  
F:/rubyProjects/fg/vendor/rails/actionpack/lib/action\_controller/filters.rb:606:in  
`process_with_filters' F:/rubyProjects/fg/vendor/rails/actionpack/lib/action_controller/base.rb:391:in`process’  
F:/rubyProjects/fg/vendor/rails/actionpack/lib/action\_controller/base.rb:386:in  
`call' F:/rubyProjects/fg/vendor/rails/actionpack/lib/action_controller/routing/route_set.rb:438:in`call’

Dove sbaglio ?

Grazieeeeeee

---

<div class="post-metadata">

**Author:** ![punkaruby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/49beb7/32.png) [@punkaruby](https://www.ruby-forum.com/u/punkaruby)\
**Post date:** [August 9, 2010, 1:52pm UTC](https://www.ruby-forum.com/t/syntax-error-unexpected-keyword-ensure/192972/2 "2010-08-09T13:52:29Z")

</div>

On Monday 09 August 2010 12:10:31 An Car wrote:

> Ciao a tutti,  
> mi farebbe assai comodo capire dove sta l’errore:

Penso che manchi il do:  
\<% form\_tag :controller =\> ‘attachments’, :action =\> ‘download’ do%\>

ciao  
Flavio

---

<div class="post-metadata">

**Author:** ![punkaruby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/49beb7/32.png) [@punkaruby](https://www.ruby-forum.com/u/punkaruby)\
**Post date:** [August 9, 2010, 3:07pm UTC](https://www.ruby-forum.com/t/syntax-error-unexpected-keyword-ensure/192972/3 "2010-08-09T15:07:32Z")

</div>

Infatti, dopo la tua segnalazione l’ho messo, e… funziona.  
Grazie mille

Flavio C. wrote:

> On Monday 09 August 2010 12:10:31 An Car wrote:
> 
> > Ciao a tutti,  
> > mi farebbe assai comodo capire dove sta l’errore:
> 
> Penso che manchi il do:  
> \<% form\_tag :controller =\> ‘attachments’, :action =\> ‘download’ do%\>
> 
> ciao  
> Flavio
