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 trialErik Dornblut
133 PointsErrors after reboot... NoMethodError: undefined method `attr_accessible' for User (call 'User.connection' to establish a
I resumed the course with this video after two days off and now getting several errors. I'll just copy them here. They also appear when I just start the server and the "insecure world writable dir..." errors appeared from day 1 but didn't disturb my program so far. Any Ideas on what this might be? I also couldn't really complete the last video - it had problems with the attr_accessible part...
Any help appreciated :) Cheers! P!
MacBook-Pro:treebook D$ rails generate migration add_user_id_to_statuses
/Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/app_rails_loader.rb:39: warning: Insecure world writable dir /Library/Frameworks/Python.framework/Versions/2.7/bin in PATH, mode 040777
/Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/shared_helpers.rb:78: warning: Insecure world writable dir /Library/Frameworks/Python.framework/Versions/2.7/bin in PATH, mode 040777
/Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/dynamic_matchers.rb:26:in method_missing': undefined method
attr_accessible' for User (call 'User.connection' to establish a connection):Class (NoMethodError)
from /Users/D/Desktop/treebook/app/models/user.rb:7:in <class:User>'
from /Users/D/Desktop/treebook/app/models/user.rb:1:in
<top (required)>'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:457:in load'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:457:in
block in load_file'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:647:in new_constants_in'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:456:in
load_file'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:354:in require_or_load'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:494:in
load_missing_constant'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:184:in const_missing'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/inflector/methods.rb:261:in
const_get'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/inflector/methods.rb:261:in block in constantize'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/inflector/methods.rb:259:in
each'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/inflector/methods.rb:259:in inject'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/inflector/methods.rb:259:in
constantize'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:566:in get'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:597:in
constantize'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/devise-3.5.1/lib/devise.rb:290:in get'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/devise-3.5.1/lib/devise/mapping.rb:81:in
to'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/devise-3.5.1/lib/devise/mapping.rb:76:in modules'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/devise-3.5.1/lib/devise/mapping.rb:93:in
routes'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/devise-3.5.1/lib/devise/mapping.rb:160:in default_used_route'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/devise-3.5.1/lib/devise/mapping.rb:70:in
initialize'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/devise-3.5.1/lib/devise.rb:324:in new'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/devise-3.5.1/lib/devise.rb:324:in
add_mapping'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/devise-3.5.1/lib/devise/rails/routes.rb:224:in block in devise_for'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/devise-3.5.1/lib/devise/rails/routes.rb:223:in
each'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/devise-3.5.1/lib/devise/rails/routes.rb:223:in devise_for'
from /Users/D/Desktop/treebook/config/routes.rb:2:in
block in <top (required)>'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:432:in instance_exec'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:432:in
eval_block'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:410:in draw'
from /Users/D/Desktop/treebook/config/routes.rb:1:in
<top (required)>'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in load'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in
block in load'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in load_dependency'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in
load'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:40:in block in load_paths'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:40:in
each'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:40:in load_paths'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:16:in
reload!'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:26:in block in updater'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/file_update_checker.rb:75:in
call'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/file_update_checker.rb:75:in execute'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:27:in
updater'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:7:in execute_if_updated'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/application/finisher.rb:69:in
block in <module:Finisher>'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:30:in instance_exec'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:30:in
run'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:55:in block in run_initializers'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:226:in
block in tsort_each'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:348:in block (2 levels) in each_strongly_connected_component'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:429:in
each_strongly_connected_component_from'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:347:in block in each_strongly_connected_component'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:345:in
each'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:345:in call'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:345:in
each_strongly_connected_component'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:224:in tsort_each'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:203:in
tsort_each'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:54:in run_initializers'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/application.rb:352:in
initialize!'
from /Users/D/Desktop/treebook/config/environment.rb:5:in <top (required)>'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in
require'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in block in require'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in
load_dependency'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in require'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/application.rb:92:in
preload'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/application.rb:143:in serve'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/application.rb:131:in
block in run'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/application.rb:125:in loop'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/application.rb:125:in
run'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/application/boot.rb:18:in <top (required)>'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in
require'
from /Users/D/.rbenv/versions/2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in require'
from -e:1:in
<main>'
3 Answers
jack duong
Courses Plus Student 100 PointsCan you post the code up?
Erik Dornblut
133 PointsFor what it's worth, here is the solution: http://stackoverflow.com/questions/17371334/how-is-attr-accessible-used-in-rails-4 problem occured when with rails 4 strong parameters where used for this... I used the way of installing the gem..
Uros Tadic
5,167 PointsI tried the solution by adding protected attributes but i still get this error when i run bundle:
Bundler could not find compatible versions for gem "activemodel":
In snapshot (Gemfile.lock):
activemodel (= 5.0.0)
In Gemfile:
rails (~> 5.0.0) was resolved to 5.0.0, which depends on
activerecord (= 5.0.0) was resolved to 5.0.0, which depends on
activemodel (= 5.0.0)
rails (~> 5.0.0) was resolved to 5.0.0, which depends on
activerecord (= 5.0.0) was resolved to 5.0.0, which depends on
activemodel (= 5.0.0)
protected_attributes was resolved to 1.0.0, which depends on
activemodel (< 5.0, >= 4.0.0.beta)
web-console was resolved to 3.3.1, which depends on
activemodel (>= 5.0)
Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
Erik Dornblut
133 PointsErik Dornblut
133 PointsNoMethodError: undefined method
attr_accessible' for User (call 'User.connection' to establish a connection):Class /Users/D/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/dynamic_matchers.rb:26:in
method_missing'I think, that this is somehow the important error. It occured after Creating the new attr_accessible in the "Build a simple ruby application" trail.