Fixed bug on ActiveRecord for Niu method