gregschmit / recurring_select

A gem for adding selectors for setting recurring events.
MIT License
333 stars 237 forks source link

Mounting into a refinerycms-based site? #9

Open skipchris opened 11 years ago

skipchris commented 11 years ago

Hi,

This gem looks perfect for my needs, but I'm having trouble using it. I don't know if this is an 'issue' or not, or just me being stupid.

Basically, I see how this works fine in a 'normal' Rails app, but I'm having trouble using it in an app which also uses RefineryCMS. Any requests to /recurring_select/translate always 404. I guess the problem is that Refinery does this:

mount Refinery::Core::Engine, :at => '/'

and I can't find a way of telling it to look at the recurring_select engine for /recurring_select/translate.

I've tried a few things which seem sensible, like this:

Refinery::Core::Engine.routes.draw do
   mount RecurringSelect::Engine, at: '/recurring_select/
end

which works at runtime, but the route still 404s.

and this

Refinery::Core::Engine.routes.draw do
  match '/recurring_select/translate' => RecurringSelectMiddleware
end

Which won't even run (missing :action).

I've tried both of the above in my app's own routes.draw block as well, same result.

I realise this could by seen as a refinerycms problem, but I doubt Refinery is the only gem which likes to mount itself at '/', so it would be good if there was a sensible, documented way of doing this.

So, I guess my questions are:

  1. Is this actually possible and I'm just being stupid? If so, apologies for using this as a help forum
  2. If it's not possible, should it be?

I'd be happy to submit a patch, but I'm not sure I know enough about what's going on with the two Engines to write something useful. If you agree that it should be possible, and can give me a clue where to start, I'd give it a go.

Cheers!

forrest commented 11 years ago

Hey @skipchris, I don't think you're being stupid, as I can see how this would be a common use-case and a common problem. Unfortunately, it's also going to be a hard one to fix. I'll leave this issue open so we circle back to it, but we'll want to get it Rails4 compatible first, and then work on that branch to deal with these issues. It seems like quite a few of our integration points are changing, and we don't want to have to solve them all twice.

skipchris commented 11 years ago

(eek, posted using the wrong account before!) @forrest Cheers! I haven't studied Engines much, so there's always a danger I'm misunderstanding something which is simple!

Sounds smart to sort Rails4 out first, so I’ll keep an eye on things and see how they change before I try and dive into anything!

joshprice commented 11 years ago

Also having this issue with a Rails 3 app mounted at /endpoint