Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Won't play nice with namespaces #2

Closed
coneybeare opened this issue Sep 17, 2010 · 7 comments
Closed

Won't play nice with namespaces #2

coneybeare opened this issue Sep 17, 2010 · 7 comments

Comments

@coneybeare
Copy link
Contributor

Without any sort of API versioning, I have my controllers in a V1, V2 namespace such that the controllers are V1::FooController < ApplicationController

The render_for_api method is thus not added to the controller as it cannot find them due to the namespace. I suggest adding support for namespaces and/or api versioning.

@coneybeare
Copy link
Contributor Author

this is not the problem actually, non-namespaced controllers are not getting the method either, despite "AbstractController::Rendering.send :include, ActsAsApi::Rendering" being called

@coneybeare
Copy link
Contributor Author

I fixed it temporarily by explicitly adding the include into the application controller. Do you have any idea why the gem include would fail?

require 'acts_as_api'
class ApplicationController < ActionController::Base
include ActsAsApi::Rendering

@fabrik42
Copy link
Owner

At the moment the including of acts_as_api is a little bit quirky.

The gem is broken since the Rails3 rc. So I think I will have to rework the include process, maybe by using the plugin methods of rails 3: http://edgeguides.rubyonrails.org/plugins.html#add-an-acts_as-method-to-active-record

@coneybeare
Copy link
Contributor Author

If this is the only way then ok, but if we can do it gem-wise, it would give users more options.

@fabrik42
Copy link
Owner

I fixed the problem this morning.
Instead of including ActsAsApi::Rendering method into the AbstactController::Rendering I included it directly in ActionController::Base

@coneybeare
Copy link
Contributor Author

great!

@fabrik42
Copy link
Owner

should work with the 0.2.1 gem version again! please note that you have to update your code, because you have to mention an api template now!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants