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

ResourceCollection lookup should also search against resource_name #2411

Merged
merged 2 commits into from Aug 15, 2013

Conversation

leemhenson
Copy link
Contributor

Hi. I hit a problem with belongs_to :foo_bar where :foo_bar refers to a resource alias:

ActiveAdmin.register Aaa::Bbb, as: "FooBar" do

As it stands, the resource is never found in the ResourceCollection and you get a lookup error. It appears belongs_to assumes the symbol is an underscored class name. I've patched the find predicate to check the resource_name as well as the resource_class when searching the collection.

What do you reckon? Is this sensible?

@seanlinsley
Copy link
Contributor

That whole file needs a suite of tests... For now, could you add some tests to confirm that it now works as you need it to?

@leemhenson
Copy link
Contributor Author

🚨

@coveralls
Copy link

Coverage Status

Coverage increased (+0%) when pulling f7a7979 on musicglue:rails4 into 72a9c30 on gregbell:rails4.

@seanlinsley seanlinsley merged this pull request into activeadmin:rails4 Aug 15, 2013
@seanlinsley
Copy link
Contributor

Thanks for the contribution!

@seanlinsley
Copy link
Contributor

Oh, hold on a minute. Why did you put this on the rails4 branch? It should have been on master.

@seanlinsley
Copy link
Contributor

I'm going to remove these changes from the rails4 branch. Please open a new PR for these changes on top of master.

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

Successfully merging this pull request may close these issues.

None yet

3 participants