This what I have - sadly, it does not work .
posts = {params[:topic][:forum_id] => { “posts_count” => “posts_count +
@topic.posts_count”}, @topic.forum_id => { “posts_count” => "posts_count
- @topic.posts_count" } }
Forum.update(posts.keys, posts.values)
It’s suppose to subtract the posts_count from topic, and add it and
subtract it from posts_count from each board, respectively.
I am fairly sure that “posts_count - @topic.posts_count” is what’s
stopping it from working and was wondering how would i go about this
better? Or if anyone can suggest an entirely better way to do this
transaction that would also be appreciated.
Thanks in advance!