Thanks James! That fixed part of my problem. I'm successfully getting my
routes to work now. However, it seems that my controller is never called,
and I'm now receiving a 404 error instead of the apps layout with "hello!"
in the body as I expected. The application I'm creating a plugin for is
redmine. It uses site layouts and the standard "<%= yield %>" code for the
body that is rendered from the called controller/action/view. I simply have
the following in my controller,and view, am I missing something else? I set
the order action to be called when the projects/order url is called.
routes.rb
connect 'projects/order', :controller => 'project_rank', :action => 'order'
project_rank_controller.rb
class ProjectRankController < ProjectsController
def order
print 'foobar';
end
end
order.rhtml
hello!
Thanks,
Todd
On Mon, Mar 3, 2008 at 1:07 PM, James Adam <[EMAIL PROTECTED]> wrote:
> The routes.rb file in your plugin should only contain the inner
> section of a normal application routes.rb file, I.e.
>
> connect '/path/:parameters', :controller => 'plugin_controller'
>
> Note that it doesn't even contain the 'map'.
>
> HTH
>
> James
>
>
>
> On 2 Mar 2008, at 21:01, "Todd Nine" <[EMAIL PROTECTED]> wrote:
>
> > Hi all,
> > I am trying to create my own plugin, and I'm not having much
> > luck. I have my structure set up with my controller, models and
> > views. I've been able to successfully migrate my database, however
> > I can't get my routes to work. I have the following basic directory
> > structure
> >
> >
> > plugins
> > +- project_ranking
> > +-controllers
> > | +-project_rank_controller.rb
> > +models
> > | +-project_rank.rb
> > +views
> > | +-order.rhtml
> > +routes.rb
> >
> >
> > I'm trying to create a new route, and here is what I've defined in
> > my routes.rb file.
> >
> > ActionController::Routing::Routes.draw do |map|
> >
> > connect 'projects/order', :controller => 'project_rank`', :action
> > => 'order'
> >
> > end
> >
> >
> > Here is what I've added to the base project's routes.rb
> >
> > map.home '', :controller => 'welcome'
> >
> > #my new routing
> > map.from_plugin :project_ranking
> >
> > ### Other routes
> >
> >
> >
> > However, when I try to load the default projects page (not a
> > plugin). I receive the following routing errors
> >
> > "no route found to match "/" with {:method=>:get}"
> >
> > If I comment out my map.from_plugin, everything works fine again.
> >
> > Any advice/help would be great.
> >
> > Thanks,
> > Todd
> > _______________________________________________
> > Engine-Developers mailing list
> > [email protected]
> >
> http://lists.rails-engines.org/listinfo.cgi/engine-developers-rails-engines.org
> _______________________________________________
> Engine-Developers mailing list
> [email protected]
>
> http://lists.rails-engines.org/listinfo.cgi/engine-developers-rails-engines.org
>
_______________________________________________
Engine-Developers mailing list
[email protected]
http://lists.rails-engines.org/listinfo.cgi/engine-developers-rails-engines.org