Já passei esse erro para vários programadores e ainda não conseguiram resolver.
Estou seguindo a postila da Caelum.
SyntaxError in Restaurantes#edit
Showing app/views/restaurantes/edit.html.erb where line #10 raised:
/home/edson/desenvolvimento/vota_prato/app/views/restaurantes/edit.html.erb:10: syntax error, unexpected ')'
... :id => @restaurante } do |f| ).to_s); @output_buffer.concat...
... ^
/home/edson/desenvolvimento/vota_prato/app/views/restaurantes/edit.html.erb:20: syntax error, unexpected keyword_ensure, expecting ')'
/home/edson/desenvolvimento/vota_prato/app/views/restaurantes/edit.html.erb:22: syntax error, unexpected keyword_end, expecting ')'
Extracted source (around line #10):
7: <% end %>
8: </ul>
9: <% end %>
10: <%= form_for :restaurante, :url => { :action => "update", :id => @restaurante } do |f| %>
11: Nome: <%= f.text_field :nome %><br/>
12: Endereço: <%= f.text_field :endereco %><br/>
13: Especialidade: <%= f.text_field :especialidade %><br/>
Trace of template inclusion: app/views/restaurantes/edit.html.erb
RAILS_ROOT: /home/edson/desenvolvimento/vota_prato
Application Trace | Framework Trace | Full Trace
/home/edson/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-2.3.8/lib/action_view/renderable.rb:91:in `module_eval'
/home/edson/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-2.3.8/lib/action_view/renderable.rb:91:in `compile!'
/home/edson/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-2.3.8/lib/action_view/renderable.rb:61:in `compile'
/home/edson/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-2.3.8/lib/action_view/renderable.rb:28:in `render'
/home/edson/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-2.3.8/lib/action_view/template.rb:205:in `render_template'
/home/edson/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-2.3.8/lib/action_view/base.rb:265:in `render'
/home/edson/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-2.3.8/lib/action_controller/base.rb:1250:in `render_for_file'
/home/edson/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-2.3.8/lib/action_controller/base.rb:936:in `render'
/home/edson/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-2.3.8/lib/action_controller/benchmarking.rb:51:in `block in render_with_benchmark'
/home/edson/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-2.3.8/lib/active_support/core_ext/benchmark.rb:17:in `block in ms'
/home/edson/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/benchmark.rb:310:in `realtime'
/home/edson/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-2.3.8/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/home/edson/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-2.3.8/lib/action_controller/benchmarking.rb:51:in `render_with_benchmark'
/home/edson/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-2.3.8/lib/action_controller/base.rb:1326:in `default_render'
/home/edson/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-2.3.8/lib/action_controller/base.rb:1332:in `perform_action'
/home/edson/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-2.3.8/lib/action_controller/filters.rb:617:in `call_filters'
/home/edson/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-2.3.8/lib/action_controller/filters.rb:610:in `perform_action_with_filters'
/home/edson/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-2.3.8/lib/action_controller/benchmarking.rb:68:in `block in perform_action_with_benchmark'
/home/edson/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-2.3.8/lib/active_support/core_ext/benchmark.rb:17:in `block in ms'
/home/edson/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/benchmark.rb:310:in `realtime'
/home/edson/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-2.3.8/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/home/edson/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-2.3.8/lib/action_controller/benchmarking.rb:68:in `perform_action_with_benchmark'
/home/edson/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-2.3.8/lib/action_controller/rescue.rb:160:in `perform_action_with_rescue'
/home/edson/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-2.3.8/lib/action_controller/flash.rb:151:in `perform_action_with_flash'
/home/edson/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-2.3.8/lib/action_controller/base.rb:532:in `process'
/home/edson/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-2.3.8/lib/action_controller/filters.rb:606:in `process_with_filters'
/home/edson/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-2.3.8/lib/action_controller/base.rb:391:in `process'
/home/edson/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-2.3.8/lib/action_controller/base.rb:386:in `call'
/home/edson/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-2.3.8/lib/action_controller/routing/route_set.rb:438:in `call'
Request
Parameters:
{"id"=>"3"}
Show session dump
Response
Headers:
{"Cache-Control"=>"no-cache",
"Content-Type"=>""}
Essa é minha view
<h1>Editando Restaurante</h1>
<% if @restaurante.errors.any? %>
<ul>
<% @restaurante.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
<% end %>
<%= form_for :restaurante, :url => { :action => "update", :id => @restaurante } do |f| %>
Nome: <%= f.text_field :nome %><br/>
Endereço: <%= f.text_field :endereco %><br/>
Especialidade: <%= f.text_field :especialidade %><br/>
<%= submit_tag "Atualizar" %>
<% end %>
<%= link_to "Voltar", { :action => "index" } %>
Este é meu controller
class RestaurantesController < ApplicationController
def index
@restaurantes = Restaurante.all(:order => "nome")
end
def show
@restaurante = Restaurante.find(params[:id])
end
def new
@restaurante = Restaurante.new
end
def create #função para inserir novo restaurante
@restaurante = Restaurante.new(params[:restaurante])
if @restaurante.save
redirect_to(:action => "show", :id => @restaurante)
else
render :action => "new"
end
end
def edit
@restaurante = Restaurante.find(params[:id])
end
def update
@restaurante = Restaurante.find(params[:id])
if @restaurante.update_attributes(params[:restaurante])
redirect_to(:action => "show")
else
render :action => "edit"
end
end
def destroy
@restaurante = Restaurante.find(params[:id])
@restaurante = destroy
redirect_to(:action => "index")
end
end