peritor/simply_stored — pull request #18 by msolovyov (2011-10-22 03:36:50+00:00)
Title: has_many not taking into account belongs_to foreign key fix

For example when having such a scenario

class Post
include SimplyStored::Couch

belongs_to :owner, :class_name => "User"
end

class User
include SimplyStored::Couch

has_many :creations, :foreign_key => "owner_id"

end

When wanting to add a post to a user by going user.add_post, an error will be thrown saying:
NoMethodError: undefined method `user_id='

This fix checks for a foreign_key in the options and sets that as the one to use.