I have a has_many belongs_to association. I registered the resource. I have shipments that belong to customers.
But when I go to the new shipment form, in the drop down select menu for customers I get #<0X0000>
Why? How can I fix it?
I think it's because the Customers table doesn't have a "name" attribute, instead I have company_name. How can I use company_name in the drop down menu?
You shouldn't override to_s method, active admin can use display_name method specially for this case
so you can add next to your model
def display_name
company_name
end
One option is to override to_s
def to_s
company_name
end
Other option is the following:
f.input :customer, :as => :select, :label_method => : company_name , :value_method => :id
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With