Layout "restaurant" stop working link to deltemethod

Hi, if i want to specify what layout has to use the view, the link to
delete method stop workind
and take to show view. i

class RestaurantsController < ApplicationController

GET /restaurants

GET /restaurants.xml

layout “restaurants”
def index
@restaurants = Restaurant.all
my_json = { :array => [1, 2, 3, { :sample => “hash”} ], :foo => “bar” }
puts JSON.pretty_generate(my_json)
respond_to do |format|
#
format.html # index.html.erb
#
format.xml { render :xml => @restaurants }
format.json {render :json => @restaurants}
end
end

GET /restaurants/1

GET /restaurants/1.xml

def show
puts params[0]
@restaurant = Restaurant.find(params[:id])

respond_to do |format|
  format.html # show.html.erb
  format.xml  { render :xml => @restaurant }
  format.json {render :json => @restaurant.comidas}
end

end

GET /restaurants/new

GET /restaurants/new.xml

def new
@restaurant = Restaurant.new

respond_to do |format|
  format.html # new.html.erb
  format.xml  { render :xml => @restaurant }
end

end

GET /restaurants/1/edit

def edit
@restaurant = Restaurant.find(params[:id])
end

POST /restaurants

POST /restaurants.xml

def create
@restaurant = Restaurant.new(params[:restaurant])

respond_to do |format|
  if @restaurant.save
    format.html { redirect_to(@restaurant, :notice => 'Restaurant

was successfully created.’) }
format.xml { render :xml => @restaurant, :status => :created,
:location => @restaurant }
else
format.html { render :action => “new” }
format.xml { render :xml => @restaurant.errors, :status =>
:unprocessable_entity }
end
end
end

PUT /restaurants/1

PUT /restaurants/1.xml

def update
@restaurant = Restaurant.find(params[:id])

respond_to do |format|
  if @restaurant.update_attributes(params[:restaurant])
    format.html { redirect_to(@restaurant, :notice => 'Restaurant

was successfully updated.’) }
format.xml { head :ok }
else
format.html { render :action => “edit” }
format.xml { render :xml => @restaurant.errors, :status =>
:unprocessable_entity }
end
end
end

DELETE /restaurants/1

DELETE /restaurants/1.xml

def destroy
@restaurant = Restaurant.find(params[:id])
@restaurant.destroy

respond_to do |format|
  format.html { redirect_to(restaurants_url) }
  format.xml  { head :ok }
end

end
end
that are the controller
these is the view

Listing restaurants

<% @restaurants.each do |restaurant| %>

//these take to <% end %>
<%= restaurant.nombre %> <%= link_to 'Show', restaurant %> <%= link_to 'Edit', edit_restaurant_path(restaurant) %> <%= link_to 'Destroy',restaurant, :confirm => 'Are you sure?', :method => :delete %><%= link_to 'Show', restaurant %>

<%= link_to ‘New Restaurant’, new_restaurant_path %>

Try restaurant_path for delete.

2011/2/8 Lorenzo Brito M. [email protected]

it was a problem with a in the layout i put a link to jquery
in other part of the page instead of head tag. thanks anyway

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs