I have an association where a code has an influencer. I want to show the influencer username as readonly in the code form.
Right now I'm doing:
form do |f|
f.inputs 'Code' do
f.input :influencer, input_html: { readonly: true, disabled: true }, as: :string if !f.object.new_record?
But I get this and I want the influencer name or username.
Ideas?
I ended up adding this line in the code model
delegate :username, to: :influencer, prefix: true, allow_nil: true
and then this in the form:
f.input :influencer_username,
label: 'Influencer',
input_html: { readonly: true, disabled: true },
as: :string unless f.object.new_record?
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