Typus gem admin controller customization
If you want to change some object attributes on update in a typus controller, you have two methods to do this:
def set_attributes_on_create
end
def set_attributes_on_update
end
the object is available as @object_name
, and request params: params[@object_name]
, so you can use it like:
class Admin::MyController < Admin::ResourcesController
private
def item_params_for_update
params[@object_name]['attribute'] = ''
super
end
end
Written by Denis Savitskiy
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#