routes.rb
-------------

map.namespace :admin do |admin|
    admin.resources :categories
    admin.resources :subcategories
    admin.resources :products
end

--
Alberto

On Nov 25, 12:15 am, "Ryan Bigg (Radar)" <[EMAIL PROTECTED]>
wrote:
> What's in your routes.rb file?
>
> 2008/11/25 cardinallijr <[EMAIL PROTECTED]>
>
>
>
>
>
> > Ryan,
>
> > Nothing in application.rb. I migrated this app from rails 1.2 and now
> > I want to create an admin control panel.
>
> > admin/products_controller.rb:
> > ------------------------------------------
>
> > class Admin::ProductsController < ApplicationController
>
> >  layout 'admin'
>
> >  def index
> >    list
> >    render :action => 'list'
> >  end
>
> >  # GETs should be safe (see
> >http://www.w3.org/2001/tag/doc/whenToUseGet.html)
> >  verify :method => :post, :only => [ :destroy, :create, :update ],
> >         :redirect_to => { :action => :index }
>
> >  def list
> >   [EMAIL PROTECTED] = Product.paginate(:per_page => 8, :page => params
> > [:page])
> >  end
>
> >  def new
> >   [EMAIL PROTECTED] = Product.new
> >  end
>
> >  def create
> >   [EMAIL PROTECTED] = Product.new(params[:product])
> >    if @product.save
> >      redirect_to admin_products_path
> >    else
> >      render :action => 'new'
> >    end
> >  end
>
> >  def edit
> >     @product = Product.find(params[:id])
> >   end
>
> >  def update
> >     @product = Product.find(params[:id])
> >     if @product.update_attributes(params[:product])
> >      redirect_to admin_products_path
> >    else
> >      render :action => 'edit'
> >    end
> >  end
>
> >  def destroy
> >   [EMAIL PROTECTED] = Product.find(params[:id])
> >   [EMAIL PROTECTED]
> >   end
>
> > end
>
> > --
> > Alberto
>
> > On Nov 24, 11:15 pm, Ryan Bigg <[EMAIL PROTECTED]> wrote:
> > > What else is in your controller? Anything in application.rb?
> > > -----
> > > Ryan Bigg
> > > Freelancerhttp://frozenplague.net
>
> > > On 25/11/2008, at 11:11 AM, Alberto Cardinalli Jr. wrote:
>
> > > > OK, first I tried to call logger.info 'message' but nothing was
> > > > logged (development.log). After this I installed ruby-debug and put
> > > > an "debugger" instruction but the execution didn't stopped on that
> > > > point. So I really believe that the destroy method isn't being
> > > > called, but why?
> > > > I know that is something really stupid but can't see what's wrong ...
> > > > Ryan, the controller is 'admin/products_controller.rb'.
> > > > I will try to fix it using the link Rick suggested.
>
> > > > Thanks,
>
> > > > --
> > > > Alberto
>
> > > > On Mon, Nov 24, 2008 at 9:29 PM, Rick <[EMAIL PROTECTED]>
> > > > wrote:
>
> > > > Hey Alberto,
>
> > > > Take a look at this site, I think it's pretty close match to what you
> > > > are trying to accomplish:
>
> > > >http://icebergist.com/posts/restful-admin-namespaced-controller-using.
> > ..
>
> > > > Rick
>
> > > > On Nov 24, 2:19 am, Ryan Bigg <[EMAIL PROTECTED]> wrote:
> > > > > The link should be:
>
> > > > > <%= link_to "Delete", admin_product_path(product), :method
> > > > > => :delete, :confirm => "Are you sure you want to delete this
> > > > > product?" %>
>
> > > > > Just to clarify: the controller you mean is admin/
> > > > > products_controller.rb, right?
>
> --
> Appreciated my help?
> Recommend me on Working With 
> Railshttp://workingwithrails.com/person/11030-ryan-bigg
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to