Displaying 1 result from an estimated 1 matches for "decrease_counters".
2012 May 15
1
How to handle ActiveRecord::RecordInvalid
...correctly, it keeps throwing me ActiveRecord::RecordInvalid. Here 
is the error page: 
<http://i.stack.imgur.com/YDiNN.png>
And here is the category service:
def self.create(params)
    ActiveRecord::Base.transaction 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] = "...