El Tuesday 13 January 2009 20:06:49 Mark Sim escribió:
> That was mistyped.   When I try this, I still get the error.
>
> Here's the whole of my controller :
>
> class AdvertisersController < ApplicationController
>   before_filter :login_required
>
>   active_scaffold :advertiser do |config|
>     config.columns = [:name, :code, :default_code, :campaigns]
>     config.columns[:campaigns].ui_type = :select
>     config.update.columns.exclude :code
>     config.create.columns.exclude :code
>     config.list.columns.exclude :default_code
>     list.sorting = {:name => 'ASC'}
>     config.action_links.add 'reports', :label => 'Report'
>   end
>
>   def title
>     "Advertisers"
>   end
>
>   def reports
>      item = Advertiser.find(params[:id])
>      redirect_to :controller => 'reports', :code => item.code
>   end
> end
>
> No route matches
> {:controller=>"advertisers", :_method=>:get, :action=>"reports"}
>
> This is SPECIFIC to RESTful routes -- if I leave the default routes at
> the bottom of routes.rb, it works fine.  I'd like to remove those,
> though.

You need to add reports to your routes. You should have:
map.resource :advertisers, :active_scaffold => true, :collection => {:reports 
=> :get}

>
> --Mark
>
> On Jan 13, 2:24 am, "Sergio Cambra .:: entreCables - Symbol Servicios
>
> Informáticos S.L. ::." <[email protected]> wrote:
> > El Monday 12 January 2009 22:07:51 Mark Sim escribió:
> > > When I do this
> > >
> > > app/controllers/advertisers_controller.rb
> > > class AdvertisersController < ApplicationController
> > >   active_scaffold :advertiser do |config|
> > >
> > >      ...
> > >      config.action_links.add 'report', :label => 'Report'
> > >   end
> > >
> > >   def reports
> > >      item = Advertiser.find(params[:id])
> > >      redirect_to :controller => 'reports', :code => item.code
> > >   end
> > > end
> > >
> > > in routes.rb
> > >
> > > ...
> > >   map.resources :advertisers, :member => {:reports
> > > => :get}, :active_scaffold => true
> > > ...
> > >
> > > I get:
> > >
> > > No route matches
> > > {:controller=>"advertisers", :_method=>:get, :action=>"report"}
> > >
> > > ideas?   How do I get my custom actions to be recognized as routes?
> >
> > You are linking to REPORT action instead of REPORTS.
> >
> > --
> > Sergio Cambra .:: entreCables - Symbol Servicios Informáticos S.L. ::.
> > Nicolás Guillén 6, locales 2 y 3. 50.018 Zaragoza
> > T) 902 021 404 F) 976 52 98 07 E) [email protected]
>
> 


-- 
Sergio Cambra .:: entreCables - Symbol Servicios Informáticos S.L. ::.
Nicolás Guillén 6, locales 2 y 3. 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) [email protected]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/activescaffold?hl=en
-~----------~----~----~----~------~----~------~--~---

  • Ho... Mark Sim
    • ... Sergio Cambra .:: entreCables - Symbol Servicios Informáticos S.L. ::.
      • ... muhammad nadeem akram
        • ... Vinicius Gati
      • ... Mark Sim
        • ... Sergio Cambra .:: entreCables - Symbol Servicios Informáticos S.L. ::.

Reply via email to