I tried for several days already, I am new to ROR and active admin. So far, I have been able to add and remove has_many relationships for the new record. And I use strong_parameters as well as accept_nested_attributes. I want to
- Ability to add and remove relationships for existing records.
Ideally, there should be an autocomplete field that allows you to search and select an existing value for this particular model.
My models
I only need the ability to add meanings that are already available for the word?
class Word < ActiveRecord::Base
belongs_to :language
has_many :word_meanings
has_many :meanings ,through: :word_meanings
form do |f|
f.semantic_errors *f.object.errors.keys
f.inputs do
f.input :language
f.input :word
f.input :wordInScript
f.input :pronunciation, :required => false, :as => :file
end
f.inputs do
f.has_many :meanings, heading: 'Meanings', allow_destroy: true, new_record: true do |a|
a.input :meaning
a.input :language
end
end
f.actions
end
source
share