Well in an ideal world you've have something containing the user that
is creating the post (eg current_user) and you would have created your
associations between these two classes. You could then do
current_user.posts.create :title => ...


Frederick Cheung wrote:

I think I need to use session for that.
I am very new to Rails and web technology.
can anybody refer me a good documentation on session in rails?
and how can i avail it?

You could start by looking at the rails guide about action controller
( http://guides.rubyonrails.org/action_controller_overview.html#session
There are a number of plugins/gems for handling authentication such as
authlogic & restful_authentication