Normally I'd insert the post ID in the form as a hidden field. Well, assuming you render the comment form on a post page
<form action="/comments" method="post">
...
<input type="hidden" name="post_id" value="<%= @post.id %>" />
</form>
Then in your ruby you can just grab it from the params
@comment = Comment.insert(:Content => params[:Content], :Post_id => params[:post_id]
Btw, just a word of advise, you should use the down case, underscored style for your properties (I'm talking about Content
and Post_id
) coz it's kinda the Ruby way. Capitalized style is used for classes and downcase underscored for properties