Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Can't get rails console to work?

http://pastebin.com/p1KHxhwr

this is what it looks like on my terminal.... i need some help so like i can't delete the user for the first user i created for the ruby generate devise videos and can't seem to delete the user so i can't even go back to the sign up sheet.... but the original problem is i can't get rails console to work

I am using rails 4.0.2 i think

8 Answers

Open terminal and type...

ruby -v

Note that down then do...

rails -v

then post your answer here

Sorry, totally missed that. The error is when you use attr_accessible in your models. That is no longer in rails 4. You should research how it has changed. Mainly, you add a private method in your controller, for example:

def todo_item_params
    params[:todo_item].permit(:content)
  end

Here, the params need a permit method on them, where you permit the column of the database. Then, in the controller action, you would put:

#old method
@todo_item =  @todo_list.todo_items.new(params[:todo_item)
#new method
@todo_item = @todo_list.todo_items.new(todo_item_params)

I highly suggest checking out this new ruby on rails project Jason recently made. http://teamtreehouse.com/library/build-a-todo-list-application-with-rails-4

It explains really well how rails 4 works, and from there you could then conceivably use rails 4 for the Treebook application.

Rails 4 and ruby 2

See here some people got it working with ruby 2 and rails 4 https://teamtreehouse.com/forum/strongparameters-and-treebook

https://teamtreehouse.com/forum/got-a-problem-with-devise-attraccessible-and-rails-4

but i can't get it to work with my own set up.....

i know all this, the problem is that it won't work using ruby 2.0.0 and rails 4.0.2

rails gives me a bunch of error using these tutorial because they aren't up to date...... i just reverted my rvm to older ruby -v and older rails -v so it fixed the problem but the original question i wanted to be answer is that is there a newer work around using ruby 2.0 and rails 4.0.2 using the strong parameters!

Strange, I'm using rails 4.0.2 and ruby 2.0.0p353 and am able to run rails console just fine.

If you can post some of the errors, usually the first few lines, we may be able to help diagnose the problem.

i did the error was in the pastebin i posted above

go to your project directory , open project and then type : rails console

Make sure you are in the location of your app. For example, if I have an app called "MyApp" inside my Sites > Projects directory, I'll need to be in there to run the console. So I run:

cd Sites/Projects/MyApp

And then run

rails console