Displaying 1 result from an estimated 1 matches for "categoryservice".
2012 May 15
1
How to handle ActiveRecord::RecordInvalid
...do
begin
category = Category.new(params)
decrease_counters(category.id)
increase_counters(category.id)
category.save!
end
end
end
In finally here is the my controller:
controller do
def create
category = Service::CategoryService.create(params[:category])
if category
flash[:notice] = "Category was successfully created."
redirect_to params[:button] == "create_and_new" ? new_admin_category_url : admin_categories_url
else
render active_admin_template(''new.html.er...