I am trying to create a WIKI page using rails 3. I am following a tutorial by http://garrickvanburen.com/archive/how-to-build-a-wiki-with-ruby-on-rails-part-1/
I believe his tutorial is in rails 2 so i am having to change the coding around. I am on section 6 and have inputed the coding inside app/views/revisions/new.html.erb.Once I load the server in localhost/revisions/new i get the following error-
NoMethodError in RevisionsController#new
undefined method `[]’ for nil:NilClass
Rails.root: /home/whitey7/wiki
Application Trace | Framework Trace | Full Trace
app/controllers/revisions_controller.rb:30:in `new’
when I pull up the revisions_controller file and view line 30 it seems correct or correct according to what was in the tutorial. Everything else seems to work fine but this. I can’t seem to find the answer or how to fix this. Any help or some guidance would be greatly appreciated. The code is below thats listed in the revisions_controller file. Thanks all!!
# GET /revisions/new
# GET /revisions/new.json
def new
@revision = Revision.new
@revision.update_attribute('person_id',
Person.find_or_create_by_name(params[:person][:name]).id) **#Inputed from Tutorial.**
respond_to do |format|
format.html # new.html.erb
format.json { render json: @revision }
end
end
params[:person] isn’t set. If you just want to avoid the error in this case, change to: