I am using the gem postmarkdown to create a blog in RoR. The Post model in the gem is not backed by a database (it uses ActiveModel). How would I go about relating a Comment model to the Post model for a blog that does not utilize a database for the blog posts?
For example, with a typical blog backed by an ActiveRecord database, I could set up the relations (such as)
class Post < ActiveRecord::Base
has_many :comments
However, in this case, I don’t know the best way to create a comment model.
If Post is an activemodel, you can’t setup relations using methods in activerecord. You can check out the README at github. It doesn’t have that functionality.
One way you could to is simply define your own methods inside Post model.
Edit:
Ah, I just find a similar question, Ruby on Rails 3 (3.1) ActiveModel Associations (tableless nested models). You can check out that as well.