I'm studing a forum and when I create a Topic I have a _form.html.erb
relative a file inside follow directory

#app/views

new.html.erb
_form.html.erb
....
....

the snippet controller to create a new topic is the follow

#app/controllers/topics_controller.rb

 def create
    @topic = Topic.new(params[:topic])
    if @topic.save
      @topic = Topic.new(:name => params[:topic][:name], :forum_id =>
params[:topic][:forum_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
########

but when I create a topic on the webinterface of the app I receive the
following error message:

#####
Showing /home/user/forum/app/views/topics/_form.html.erb where line #9
raised:

undefined method `content' for :post:Symbol

Extracted source (around line #9):

6:      <%= f.text_field :name %>
7:    </p>
8:    <p>
9:    <%= f.text_area :post.content %><%= @post.content %>   </p>
10:    <p><%= f.submit "Create" %></p>
11:  <% end %>
#####

It's a syntax error ?  I'm converting an example app from a Rails 2 to
Rails 3

thanks,


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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to