How to disable a select associaition from simple form

Asked

Viewed 34 times

0

I have a select Association of the simple form, the value of it passed via controler and I wish that in the form the user did not have the option to select another value. I have tried using disabled:true (Disables as I want but does not send the value when saved) disabled: [true], input_html: {disabled: true} and readonly: true, none of which solved the problem, always allowing selecting another value in select. Any suggestions on how to display the selected value without the user being able to select another?

1 answer

1

You can exchange the select field for a plain text field when you are on the edit screen or put no field keeping only the text in a div.

Another option is to keep it like this and create a rule in the model before_update not allowing the value initially recorded not to be changed.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.