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:
8:
9: <%= f.text_area :post.content %><%= @post.content %>
10:
<%= f.submit “Create” %>
11: <% end %>
It’s a syntax error ? I’m converting an example app from a Rails 2 to
Rails 3
thanks,
C