lib/vundabar/orm/associations.rb in vundabar-0.1.0 vs lib/vundabar/orm/associations.rb in vundabar-0.2.0

- old
+ new

@@ -8,10 +8,9 @@ foreign_key = options.fetch(:foreign_key, foreign_key_column) model.where("#{foreign_key} LIKE ?", id) end end - def belongs_to(model_name, options = {}) define_method(model_name) do class_name = model_name.to_s.singularize.capitalize model = options.fetch(:class_name, class_name).to_constant foreign_key = model_name.to_s.concat("_id")