lib/common/base.rb in inkwell-0.1.1 vs lib/common/base.rb in inkwell-1.0.4

- old
+ new

@@ -10,7 +10,17 @@ else raise "obj should be Comment or #{post_class.class}" end is_comment end + + def check_user(obj) + user_class = Object.const_get ::Inkwell::Engine::config.user_table.to_s.singularize.capitalize + raise "user should be a #{user_class.to_s}" unless obj.is_a? user_class + end + + def check_post(obj) + post_class = Object.const_get ::Inkwell::Engine::config.post_table.to_s.singularize.capitalize + raise "post should be a #{user_class.to_s}" unless obj.is_a? post_class + end end end \ No newline at end of file