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

Already on GitHub? Sign in to your account

Is it possible to refer to a class in a module? #155

Closed
dogweather opened this Issue May 3, 2012 · 2 comments

Comments

Projects
None yet
3 participants

Our controller accesses the class via the module reference, i.e. Stockcar::Undercarriage. And the autocomplete statements fail, because a declaration like this:

autocomplete stockcar_undercarriage, model

gets parsed into something like this:

StockcarUndercarriage.model

instead of

Stockcar::Undercarriage.model

...which is what we'd need. We've tried bringing Undercarriage into the namespace, but it doesn't work: the autogenerated autocomplete method in the controller gives the error of undefined constant.

So - we're wondering if there's an autocomplete syntax that'd account for this. Thanks!

Try it this way:

Controller:
autocomplete "members_university", :name, :class_name => "Members::University"

Routes:
resources :welcome do
get :autocomplete_members_university_name, :on => :collection
end

View:
<%= autocomplete_field_tag 'name', '', autocomplete_members_university_name_welcome_index_path, :size => 75 %>

Worked fine for me !

Member

manusajith commented Nov 27, 2013

@dogweather I hope you have resolved this issue.
I am closing this issue as its over 2 years old now, but please be free to re-open if you still have any issues.
@OneDivZero thanks for helping out

@manusajith manusajith closed this Nov 27, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment