No need create only 2 simple line in the follow file
#app/controllers/topics_controllers
def new
@topic = Topic.new
@post = Post.new
end
def create
def create
@topic = Topic.new(params[:topic])
if @topic.save
@topic = Topic.new(:name => params[:topic][:name], :forum_id =>
params[:topic][:forum_id])
@post = Post.new(:content => params[:post][:content], :topic_id =>
Topic.first.id)
if @post.save
flash[:notice] = "Successfully created topic."
redirect_to "/forums/#{@topic.forum_id}"
else
render :action => 'new'
end
else
render :action => 'new'
end
end
########
bye to me
C
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.