I am having a lot of trouble setting this gem up. I just added the gem yesterday--first, is it truly compatible with Rails 4? (because that's what I am using)
If so I'm not sure what I am doing wrong. I have UserOrganizations and Organizations models. UserOrganizations stores the relationships between users and orgs--so it belongs to orgs.
I want people to search by the organization's :name to add it as a relationship to their user account. In the user_organizations_controller.rb:
autocomplete :organization, :name, full: true
routes.rb:
resources :user_organizations do
get :autocomplete_organization_name, on: :collection
end
Then, continuing on with the tutorial provided here, I add the following in UserOrganization's _form.html.erb:
<%= f.autocomplete_field :organization_name,
autocomplete_organization_name_user_organizations_path %>
This then returns:
undefined method `organization_name' for #<UserOrganization:0x6846f48>
In the view, do I actually need to put in :organization? :name? If not, I am not sure what I need to be doing differently, I followed the tutorial pretty closely and it put in :brand_name despite that not being an actual attribute name. I have the gems jquery-rails and jquery-ui-rails installed, and autocomplete-rails.js is listed with the other script files. Thanks for any help. This is, of course, after restarting the server repeatedly.