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
Tony Kim
2,031 PointsCan't get rails console to work?
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
Ben Brown
Courses Plus Student 662 PointsOpen terminal and type...
ruby -v
Note that down then do...
rails -v
then post your answer here
Brandon Barrette
20,485 PointsSorry, 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.
Tony Kim
2,031 PointsRails 4 and ruby 2
Tony Kim
2,031 PointsSee 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.....
Tony Kim
2,031 Pointsi 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!
Brandon Barrette
20,485 PointsStrange, 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.
Tony Kim
2,031 Pointsi did the error was in the pastebin i posted above
Yash Shukla
1,437 Pointsgo to your project directory , open project and then type : rails console
Brandon Barrette
20,485 PointsMake 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