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 trialGuled A.
10,605 PointsHaving trouble with Ruby versions in 'Simple Ruby Application'
I am currently running Ruby version 4.1.1 and I had installed 'Devise' for authentication. I was following the video lesson: "Generating the Devise Views". I created a Devise view and I stumbled upon a file in which I had the same code as in the video accept that I was missing a part.
I was viewing the models directory, where the user.rb file was located, and I had this code:
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
end
The video lesson had this code:
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
attr_accessible :email, :password, :password_confirmation, :remember_me, :first_name, :last_name, :profile_name
end
Every time I add:
attr_accessible :email, :password, :password_confirmation, :remember_me, :first_name, :last_name, :profile_name
I get an error that looks like this: http://oi57.tinypic.com/155hzkg.jpg
I am not sure if the video course is running a different version of 'Devise'.
Can anyone help me sort out this issue?
Can I get an instructor to assist me?
1 Answer
Binary Soul
4,592 Pointsattr_accessible is depricated and not longer supported by Rails 4 but attr_accessor is working still. Anyways, Action Pack will undestand what to do, because of the new Way in Rails 4: Strong_Parameters. Using "Strong_Parameters" is required in Rails 4 and there is no way around. They will take place in your controller instead of the Model.
But its hard to make a non-rails4 applications with Rails 4.1 LOTS of things have changed. I also was facing hundret of Problems with "deprecation"
Guled A.
10,605 PointsGuled A.
10,605 PointsThank you for the reference. I'll take a good read at the docs, and see how to fix this.
EDIT: Found a solution. Thank you for the docs.