There has been a Rails Lighthouse ticket submitted for this issue.
Because this is an issue that I think ought to be fixed in Rails,
here's how you can +1 this ticket and provide more information on why
this ought to be fixed in Rails.
If you do not have a Rails Lighthouse profile here's where you can
sign up for one. It ought to redirect you to the ticket when you've
filled out the required fields.
https://rails.lighthouseapp.com/users/new?to=%2Fprojects%2F8994%2Ftickets%2F2592-plugin-routes-override-application-routes
If you already have a rails lighthouse profile, here's the ticket:
https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/2592-plugin-routes-override-application-routes#ticket-2592-6
Hopefully this gets fixed in Rails so we don't have to monkey patch to
get route overriding working. If you're interested in the monkey patch
which ought to work, look at the comments on the ticket which link
here:
http://giantrobots.thoughtbot.com/2009/4/23/tips-for-writing-your-own-rails-engine
Jason
Given that this would really help us out for both the blacklight and
the hydra projects, is there anyone out there who feels up to tackling
this?
Bess
> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google
> Groups "Blacklight Development" group.
> To post to this group, send email to blacklight-...@googlegroups.com
> To unsubscribe from this group, send email to blacklight-develo...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/blacklight-development?hl=en
> -~----------~----~----~----~------~----~------~--~---
>
This is true in a "meta" sense. What Blacklight should define in the
plugin are actions that can be wired into controllers. How many
controllers does an app like searchworks or virgo beta need (that use
Solr, that is)? One or two, right? Those actions could be defined
in the plugin, and brought into an application defined controller
easily and configurably.
For example (and I know it isn't as elegant or exemplar as one would
like), here's the Flare controller:
<http://svn.apache.org/repos/asf/lucene/solr/trunk/client/ruby/flare/vendor/plugins/flare/app/controllers/browse_controller.rb
>
Yes, that controller is in the plugin, but what I'm proposing is that
it actually be pulled up to the application itself. The "flare" macro
there comes from the plugin as I'm proposing it should with
Blacklight. Many actions come along for that ride, and parameters
could be passed to it.
Putting less application-level stuff in Blacklight, yet making it
capable of being powerfully wired into an application is the goal I'm
aiming for.
> So, I agree that the application should define this, but: a) it
> needs to
> be done in routes, not just in naming conventions of the controller,
> and
I disagree that it needs to be defined in routes, per se. But even
so, a clever Blacklight plugin level macro seems like it could wire
into routes, but specified at the application level. Not routes
defined actually in the plugin.
> b) _some_ default needs to be in the Blacklight plugin. (I'm
> unconcerned
> with what this default is, because I think it's more important to make
> it easily over-rideable in the Application via routes).
Nah... just a demo application that has a controller that says:
class ViewController < ApplicationController
blacklight
end
I don't see a need for the plugin itself to _be_ the application. But
a demo application, I'm all for no question.
> Just my point of view!
Likewise ;)
Erik
JUST changing a URL, though, in the bigger sense is significant. It's
your applications "control" over how the world interacts with it.
This URL is the heart of the system.
But yeah, this is all about "just" changing the URL. Or rather,
making it flexible to have controllers with different types of Solr
parameter mappings easily (and all actions from that controller that
come into existence are based on that controller-specific config). In
the early days of Blacklight there was a desire to have a Music
Library interface along with the main general public interface. This
would translate to two controllers, a BrowseController (I prefer
"browse" to view or catalog, personally) and a MusicController. The
music controller would have something (off the top of my head) like:
blacklight :facets => [:instrument, :period, :key, ... whatever]
or...
blacklight :request_handler => :music
or with a smart default no parameter would be needed, but each
controller would be based off the controller names request handler
mapping... /solr/browse?q=.... /solr/music?q=....
Too much magic yet?! ;)
> I will need to create a controller (generated or manual) called
> 'something' and include the plugins CatalogController at the top?
Basically, yeah.
> If so, that seems like overkill to me. Maybe I'm not understanding
> this correctly.
A single controller with one line of code is overkill? Versus doing
app-level routes to plugin-level actions? Pull the plugin _into_ the
app, I'm proposing. With meta Ruby magic like it's good for.
before_filter-like stuff.
> Also, I would like to put in a shameless plug for my previous
> suggestion of how to allow the app to override the plugins routes
> until Rails fixes the bug. (Email to list w/ Subject = "Changing
> the plugins default route 'catalog" sent on 9/11/09). I haven't
> heard anything for or against this posted on the list.
I just don't see why the plugin needs publicly accessible routes at
all. Let an app-level controller or two weave them in.
I do a lot of pondering how I idealize these things. You folks are in
the trenches building these apps. My thoughts are meant as food for
contemplation, and maybe some of it will be useful to take away and
incorporate.
One of these days I'll incorporate all my ramblings into Flare. I've
laid things out enough in prose that I could have probably as easily
just coded it up.
Shuttin' up now ;)
Erik
Also, I would like to put in a shameless plug for my previous suggestion of how to allow the app to override the plugins routes until Rails fixes the bug. (Email to list w/ Subject = "Changing the plugins default route 'catalog" sent on 9/11/09). I haven't heard anything for or against this posted on the list.-Jessie
Jason