making attr_readonly fields disabled #877

comboy opened this Issue Jul 30, 2012 · 4 comments


None yet

2 participants

comboy commented Jul 30, 2012


What do you think about making fields listed as attr_readonly disabled in edit form by default? I'd gladly try to contribute this, I just wanted to check if it's indeed a good idea.


I don't think we need any more magic or any more reasons to use the quick form syntax :)

In projects where I've needed a disabled field (I use them quite a lot, actually), I implemented a DisabledStringInput (subclassed from Formtastic::Inputs::StringInput and simply called :as => :disabled_string explicitly on the inputs.

comboy commented Jul 31, 2012

I'm all against magic, but whole f.input :foo syntax seems to be about magic and not telling it, what it can already get from the model.

Without this, there's redundancy between model and view where you do this like you said or something like f.input :name, input_html: {disabled: f.object.persisted?} that I have. Without this behavior seems a bit unnatural, you have a normal form, you submit it, and data is not updated. Why letting user edit something that cannot be updated?

Sorry that I keep asking, I very much respect your decision since all previous ones lead to very nicely designed library, please just think about it some more when you have a sec.


@comboy agreed, there's plenty of magic, my argument is that I'm not really interested in more magic without a seriously strong rationale. I'll be removing magic in upcoming versions :)

I just can't see this being a major pain point for the average developer. Can you get specific about your use case?

comboy commented Aug 2, 2012

@justinfrench Yes I guess most people just don't display these readonly fields in edit form.

My use case is mostly through activeadmin.

Thanks for taking time to explain and good luck fighting magic :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment