Syntax error, unexpected kENSURE, expecting $end

i m newbie to ROR.
under views, i create a new.html.erb as following:

<%=form_tag :action => ‘create’ %>
<%= render :partial => ‘form’ %>
<%= submit_tag ‘Create’ %>
<% end %>
<%= link_to ‘Back’, :action => ‘index’ %>

and then i got error:

  1. Error:
    test_new(Admin::AuthorControllerTest):
    ActionView::TemplateError: compile error
    E:/Ruby/Projects/Emporium/emporium/app/views/admin/author/new.html.erb:6:
    syntax
    error, unexpected kENSURE, expecting $end
    On line #6 of app/views/admin/author/new.html.erb

    3: <%= submit_tag ‘Create’ %>
    4: <% end %>
    5: <%= link_to ‘Back’, :action => ‘index’ %>

my work env are:
Ruby version 1.8.6 (i386-mswin32)
RubyGems version 1.3.5
Rack version 1.0
Rails version 2.3.5
Active Record version 2.3.5
Active Resource version 2.3.5
Action Mailer version 2.3.5
Active Support version 2.3.5
Application root E:/Ruby/Projects/Emporium/emporium
Environment development
Database adapter mysql
Database schema version 20091209055844

Max G. wrote:

<%=form_tag :action => ‘create’ %>
<%= render :partial => ‘form’ %>
<%= submit_tag ‘Create’ %>
<% end %>
<%= link_to ‘Back’, :action => ‘index’ %>

How did you create this form?

You’ve missed the ‘do’ keyword in the line,
<%=form_tag :action => ‘create’ %>

It should be,
<%=form_tag :action => ‘create’ do %>

Max G. wrote:

i m newbie to ROR.
under views, i create a new.html.erb as following:

<%=form_tag :action => ‘create’ %>
<%= render :partial => ‘form’ %>
<%= submit_tag ‘Create’ %>
<% end %>
<%= link_to ‘Back’, :action => ‘index’ %>

and then i got error:

  1. Error:
    test_new(Admin::AuthorControllerTest):
    ActionView::TemplateError: compile error
    E:/Ruby/Projects/Emporium/emporium/app/views/admin/author/new.html.erb:6:
    syntax
    error, unexpected kENSURE, expecting $end
    On line #6 of app/views/admin/author/new.html.erb

    3: <%= submit_tag ‘Create’ %>
    4: <% end %>
    5: <%= link_to ‘Back’, :action => ‘index’ %>

my work env are:
Ruby version 1.8.6 (i386-mswin32)
RubyGems version 1.3.5
Rack version 1.0
Rails version 2.3.5
Active Record version 2.3.5
Active Resource version 2.3.5
Action Mailer version 2.3.5
Active Support version 2.3.5
Application root E:/Ruby/Projects/Emporium/emporium
Environment development
Database adapter mysql
Database schema version 20091209055844

it works for me through your way. thanks a lot, Punit Rathore

Punit Rathore wrote:

Rather it should be
<% form_tag :action => ‘create’ do %>

Punit Rathore wrote:

You’ve missed the ‘do’ keyword in the line,
<%=form_tag :action => ‘create’ %>

It should be,
<%=form_tag :action => ‘create’ do %>

Rather it should be
<% form_tag :action => ‘create’ do %>

Punit Rathore wrote:

You’ve missed the ‘do’ keyword in the line,
<%=form_tag :action => ‘create’ %>

It should be,
<%=form_tag :action => ‘create’ do %>