-
Notifications
You must be signed in to change notification settings - Fork 57
Namespace Conflict: Journey is a very generic name #49
Comments
Why don't you use a namespace? So you can use Journey for your model and from the gem |
A namespace would work, but its a serious amount of effort to rename everything. Its been my experience that namespacing models in Rails is generally more effort than its worth. The solution I have in mind at the moment, if I can't convince anyone to rename, is to write a couple of Rake tasks to automatically rename |
Probably we could rename this library, but it means a major revision name. The thing is, humans are not clairvoyant (that I know of). Any name chosen could possibly conflict with other projects, however no gem name was taken when I released this. What makes your private project (that I would have no idea about) more important than mine? Aaron Patterson On Sep 20, 2012, at 5:55 PM, Sam Lown notifications@github.com wrote:
|
that's the point, I'm with @tenderlove. If you have name conflict with external gems, you should take action, not the other way around. Simply take the effort to namespace your model if it's so important to call it Journey. |
This may have been true in the past but I regularly use namespaced models (both nested models and models inside a module) without any problems. As for renaming your model why not use |
Absolutely nothing :-) My only line of reasoning is that "Journey" is a very generic common noun, which many other developers are likely to use now and in the future. It is my newly formed belief (frankly, I never thought about this before) that projects should not be named after common nouns as these are the names more likely to be used by data modellers to describe things in the physical world. I guess this doesn't come up very often because there are very few projects that use common nouns. Rack is about the only gem required by Rails in a similar situation. Journeys are our business, it is the core of everything we do. Renaming would be totally impractical. We don't just use it in Rails, we use it in our Node.js server, Android app, and iOS (Obj-C, Rubymotion [1]) apps, with more in the pipeline. Whereas I really hope you understand my predicament. [1] http://blog.rubymotion.com/post/30514580062/rubymotion-success-story-cabify |
Remaning the gem is also very impractical. It means breaking anyone that relies on the current constants. Breaking current constants means that I must release a major version. We don't want to switch Rails's dependencies to a major version in a bugfix release. I understand your predicament, but can you see mine? It impacts many people and if I want to follow semver (which I do), it takes much more time than doing a quick release.
I'm open to helping, but this kind of logic doesn't sway me. "Journeys" being the core of your business doesn't make changing code impractical. Can you offer a solution besides "please rename your gem"? TBH, I'm partial to pushing the router back in to Rails, but that certainly won't happen for Rails 4 (or a bug release version). |
This spurs a interesting discussion (at least for me): as gems creators (and maintainers), what are the precautions one has to think of when naming a global constant? Is there any discussion on this already opened in mailing lists or github? |
I totally appreciate that it would not be possible without a major release, I certainly wouldn't hope for a modification to the current Rails 3.2, way too late for that. It would be great if this could be considered for Rails 4 though, or at least have a new name before then so I can run my own patched version of Rails 3.2. A quick google search [1] suggests that 'journey' is only used by ActionPack, nothing else. This is pure speculation, but I don't see much evidence to believe many people would actually notice if the name was changed. I really don't have anything else to go on here in terms of solutions. I can only try to appeal to your nice natures and suggest that common nouns should not be used for the names of projects. I'd certainly be willing to offer a couple of pull requests with a new name if that helps... [1] site:gemcutter.org dependencies journey -replacement |
In one of my projects I check for the |
On Thu, Sep 20, 2012 at 12:40 PM, Sam Lown notifications@github.com wrote:
Might I suggest ActionRouter or ActiveRouter. lenjaffe@lenjaffe.com 614-404-4214 |
If the suggested intervention is for @samlown to namespace his models, might it then make sense for Rails 4 to start generating application models and other classes in the application namespace by default? |
I think we have time for Rails 4 to rename (though if someone made the patches for me, I would appreciate it).
I'm fine with either of these. @rafaelfranca what are you trying to detect by looking for the constant? Maybe there is something we need to do better? |
Editorial note for whoever does the patch :). To be coherent with the naming conventions in Rails |
Wouldn't it make more sense to move it to the |
Actually looking at it |
@pixeltrix you may be right, but I think that would mean shipping the existing Journey code along with the AP gem. Renaming the gem may be a less extreme change. That said, I'm not against pushing the code in to AD. The main reason is that I think the routing code was prematurely extracted from Rails. I like the idea of having a separate gem that knows how to route, but the interface is so complex (and specific) that basically only Rails can use it. I'd like to extract a better object model for the router. Opinions are definitely welcome! |
@tenderlove I searched in the code and I'm not checking the constant anymore. I think is a good path renaming the Journey to Action Router. |
Your constant name is already in use. You may want to try
❤️ ruby |
@jeremy |
Whether it's in a separate gem or in the AP gem gem it's still the same weight of code - it's not like anyone would use AP with something other than Journey - one less dependency for Bundler to resolve.
Agree on the premature extraction - perhaps re-integrate for now and look to a general purpose router for Rack 2 (whatever the status of that is). |
I've got the same problem: Rails 3.2 upgrade from 2.3.x, and a model named Journey. @samlown, did you end up namespacing Journey, or write those rake tasks? |
@bakongo we've been too busy and not really had a need to upgrade from 3.1 yet. I'll post a gist when we have something. |
Not for nothing, this is a problem with flat namespaces. |
Move the Journey code underneath the ActionDispatch namespace so that we don't pollute the global namespace with names that may be used for models. Fixes rails/journey#49.
Move the Journey code underneath the ActionDispatch namespace so that we don't pollute the global namespace with names that may be used for models. Fixes rails/journey#49.
Closing this since Journey has now been integrated into Action Dispatch. |
Hi. Sorry for arriving a bit late here, but we only just got round to starting an upgrade to Rails 3.2.
Unfortunately, we have a model in our project called "Journey". This causes a conflict with this new Journey module in Rails 3.2.
Firstly, is there a known way to get around this issue? (I can't think of any, but you never know.)
Secondly, could you consider renaming the project to something that isn't a common noun? Even a made-up verbal noun would be better than "journey", like "journeying", "journeyer", "travelling", or "actionjourney". Who cares to be honest, as far as I can tell no one is every actually going to type it in except the few programmers maintaining ActionPack and the project itself.
I really hope this can be resolved, in the meantime we're rolling back to Rails 3.1.
The text was updated successfully, but these errors were encountered: