Errors while running step 5.6

Hi, I received the following error while running the step 5.6 (I’m using both the edge and the legacy docs)

TypeError

in PostsController#create

can't convert Symbol into String

Rails.root: /home/pdipietro/blog

Application Trace | Framework Trace | Full Trace

app/controllers/posts_controller.rb:19:in `post_params'
app/controllers/posts_controller.rb:8:in `create'
   This error occurred while loading the following files:
post

Has anyone an idea on how the thing should be changed?

Here is PostsController

class PostsController < ApplicationController
	def new
	end
	def index
  	@posts = Post.all
	end
	def create
		@post = Post.new(post_params)
		@post.save
		redirect_to @post
	end

	def show
		@post = Post.find(params[:id])
	end

	private
		def post_params
			params.require(:post).permit(:title, :text)
		end
end

TIA

Paolo

Hi Paolo,

Could you please put this application up on github so that we could take a look at it?

Thanks!

Ryan,

As I’m new, I shoudn’t want to break anything!!!

Please, tell me how and where to add the application.

Thank you

Paolo

Paolo,

It’s as simple as uploading a Git repository to GitHub. I don’t think there’s much you can do to break that. Start here and work your way through the bootcamp: https://help.github.com/articles/set-up-git

Ryan,

The application is on https://github.com/pdipietro/demoblog

let me know ....

Paolo

Paolo,

Are you referring to below 2 getting started guides?

http://guides.rubyonrails.org/getting_started.html#installing-rails

http://edgeguides.rubyonrails.org/getting_started.html#installing-rails

If yes, then both the guides that your are referring to are written for Rails 4. Your application is using Rails 3.2.14.

Check section “3.1 Installing Rails” => “If it says something like “Rails 4.0.0”, you are ready to continue.”

If you are learning Rails using the getting started guide I would suggest you upgrade your application to use Rails 4.0.0 for the best experience. If you get stuck you can also access the source code of the getting started guide @ https://github.com/rails/docrails/tree/master/guides/code/getting_started

Thank you Harshal,

I got this answer

pdipietro@neo4j-ubu64:~/blog$ gem list rails

*** LOCAL GEMS ***

rails (4.0.0, 3.2.14)

Now, how can I select the correct version to run?

TIA

Paolo

“gem list rails” gives you a list of all the versions of Rails installed on your system. Your Rails application picks the version of Rails from the Gemfile.

Your Gemfile: https://github.com/pdipietro/demoblog/blob/master/Gemfile#L3

Rails guide Gemfile: https://github.com/rails/docrails/blob/master/guides/code/getting_started/Gemfile#L3

Change “gem ‘rails’, ‘3.2.14’” to “gem ‘rails’, ‘4.0.0’” in your Gemfile. Also make sure that rest of your Gemfile matches the Gemfile from Rails guide to avoid further problems with the getting started guide.

It runs! Thank you very much.

Paolo