-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upmin Model hijacking Class Name #171
Comments
Upmin::Model automatically delegates everything to the associated Model. If you want the field to appear in the form but be read only, I suggest you override the attribute partial. This is not well documented, but UpminAdmin tries a cascade of possible partial files for every attribute. I suggest you take a look at : To log the possible partials you can override I've overridden this class in my app like so :
On the other hand if you just want to remove that field from the form, I just pushed a little fix on the master branch to make it possible to specify different attributes for the create/edit form :
I hope this can help you. |
It looks like you're setting the upmin model class name to that of the ActiveRecord model. In our application, this doesn't seem to matter until we write tests. We can operate on our own models as needed and set read only attributes on the upmin AdminModels. This allows our application to dynamically update fields without opening them up for editing by some of our admin interface users.
When we run tests however, those tests run against the upmin models which prevent those same updates from succeeding.
Subscription.update(status: 'active') will work in a model or controller, but it won't work from a test if we've set attr_readonly(:status) on the AdminSubscription model.
The text was updated successfully, but these errors were encountered: