Getting error when run command "rails console"

Hii everyone,

I m newbie to RoR. Today morning i have just updated my gems file using command update gems. My earlier rails version was 4.1.4 and now updated rails version is 4.1.5. When i m trying to open console gives me error. Below is error list:-

/home/xyz/.gem/ruby/gems/activerecord-4.1.4/lib/active_record/dynamic_matchers.rb:26:in method_missing': undefined method attr_accessible’ for #<Class:0x00000002983670> (NoMethodError)
from /home/suvarna/.gem/ruby/gems/acts_as_votable-0.5.0/lib/acts_as_votable/vote.rb:8:in <class:Vote>' from /home/suvarna/.gem/ruby/gems/acts_as_votable-0.5.0/lib/acts_as_votable/vote.rb:4:in <module:ActsAsVotable>’
from /home/suvarna/.gem/ruby/gems/acts_as_votable-0.5.0/lib/acts_as_votable/vote.rb:3:in <top (required)>' from /home/suvarna/.gem/ruby/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in require’
from /home/suvarna/.gem/ruby/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in block in require' from /home/suvarna/.gem/ruby/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:232:in load_dependency’
from /home/suvarna/.gem/ruby/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in require' from /home/suvarna/.gem/ruby/gems/acts_as_votable-0.5.0/lib/acts_as_votable.rb:11:in <module:ActsAsVotable>’
from /home/suvarna/.gem/ruby/gems/acts_as_votable-0.5.0/lib/acts_as_votable.rb:6:in <top (required)>' from /home/suvarna/.gem/ruby/gems/bundler-1.6.5/lib/bundler/runtime.rb:76:in require’
from /home/suvarna/.gem/ruby/gems/bundler-1.6.5/lib/bundler/runtime.rb:76:in block (2 levels) in require' from /home/suvarna/.gem/ruby/gems/bundler-1.6.5/lib/bundler/runtime.rb:72:in each’
from /home/suvarna/.gem/ruby/gems/bundler-1.6.5/lib/bundler/runtime.rb:72:in block in require' from /home/suvarna/.gem/ruby/gems/bundler-1.6.5/lib/bundler/runtime.rb:61:in each’
from /home/suvarna/.gem/ruby/gems/bundler-1.6.5/lib/bundler/runtime.rb:61:in require' from /home/suvarna/.gem/ruby/gems/bundler-1.6.5/lib/bundler.rb:132:in require’
from /home/suvarna/Downloads/forbestechnosys-kms-5d6b520558db/config/application.rb:7:in <top (required)>' from /home/suvarna/.gem/ruby/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:146:in require’
from /home/suvarna/.gem/ruby/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:146:in require_application_and_environment!' from /home/suvarna/.gem/ruby/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:68:in console’
from /home/suvarna/.gem/ruby/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:40:in run_command!' from /home/suvarna/.gem/ruby/gems/railties-4.1.4/lib/rails/commands.rb:17:in <top (required)>’
from script/rails:6:in require' from script/rails:6:in <main>’

How can i resolve it??? Plzzzzzzz help.:frowning: :frowning:

Hi there,

The attr_accessible method has been removed from Rails 4.1+

You’re using version 0.5 of of the ‘acts_as_votable’ gem which relies on this method, if you update the version to the latest in Gemfile and run ‘bundle install’ it should work as expected.
gem ‘acts_as_votable’, ‘~> 0.10.0’

If you’re using attr_accessible in other parts of your application you’ll need to learn about Strong Parameters

Hii Markbrown4,

Your answer was so much helpful for me. It have solved method missing error for me. I have changed the version of “acts_as_votable” 0.5 to 0.10 and bundle install. but now i m getting new error:-

home/suvarna/.gem/ruby/gems/strong_parameters-0.1.4/lib/action_controller/parameters.rb:6:in <module:ActionController>': superclass mismatch for class ParameterMissing (TypeError) from /home/suvarna/.gem/ruby/gems/strong_parameters-0.1.4/lib/action_controller/parameters.rb:5:in <top (required)>’
from /home/suvarna/.gem/ruby/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in require' from /home/suvarna/.gem/ruby/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in block in require’
from /home/suvarna/.gem/ruby/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:232:in load_dependency' from /home/suvarna/.gem/ruby/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in require’
from /home/suvarna/.gem/ruby/gems/strong_parameters-0.1.4/lib/strong_parameters.rb:1:in <top (required)>' from /home/suvarna/.gem/ruby/gems/bundler-1.6.5/lib/bundler/runtime.rb:76:in require’
from /home/suvarna/.gem/ruby/gems/bundler-1.6.5/lib/bundler/runtime.rb:76:in block (2 levels) in require' from /home/suvarna/.gem/ruby/gems/bundler-1.6.5/lib/bundler/runtime.rb:72:in each’
from /home/suvarna/.gem/ruby/gems/bundler-1.6.5/lib/bundler/runtime.rb:72:in block in require' from /home/suvarna/.gem/ruby/gems/bundler-1.6.5/lib/bundler/runtime.rb:61:in each’
from /home/suvarna/.gem/ruby/gems/bundler-1.6.5/lib/bundler/runtime.rb:61:in require' from /home/suvarna/.gem/ruby/gems/bundler-1.6.5/lib/bundler.rb:132:in require’
from /home/suvarna/Downloads/forbestechnosys-kms-5d6b520558db/config/application.rb:7:in <top (required)>' from /home/suvarna/.gem/ruby/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:146:in require’
from /home/suvarna/.gem/ruby/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:146:in require_application_and_environment!' from /home/suvarna/.gem/ruby/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:68:in console’
from /home/suvarna/.gem/ruby/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:40:in run_command!' from /home/suvarna/.gem/ruby/gems/railties-4.1.4/lib/rails/commands.rb:17:in <top (required)>’
from script/rails:6:in require' from script/rails:6:in <main>’

Plzzz tell me how to resolve this…

Can you post your Gemfile?

I think you may have included “strong_parameters” but you shouldn’t have, it’s part of Rails since version 4.

My gemfile is :-

source ‘http://rubygems.org

gem ‘rails’
gem ‘pg_search’
gem ‘pg’
gem ‘jquery-rails’
gem ‘simple_form’
gem ‘thin’
gem ‘twitter-bootstrap-rails’
gem ‘bootstrap-datepicker-rails’
gem ‘sorcery’
gem ‘jquery-datatables-rails’
gem ‘aasm’
gem ‘bootstrap-wysihtml5-rails’
gem ‘carrierwave’
gem ‘rmagick’
gem ‘nested_form’
gem ‘cancan’
gem ‘will_paginate’
gem ‘bootstrap-will_paginate’

gem ‘ancestry’
gem ‘sqlite3’, group: :sqlite3
gem ‘unicorn’
gem ‘newrelic_rpm’
gem ‘cache_digests’
gem ‘rack-mini-profiler’
gem ‘minitest’
gem ‘strong_parameters’
gem ‘acts_as_votable’, ‘~> 0.10.0’

group :assets do
gem ‘less-rails’
gem ‘sass-rails’
gem ‘coffee-rails’
gem ‘uglifier’
gem ‘therubyracer’, :platform => :ruby
gem ‘chosen-rails’
end

group :test do
gem ‘faker’
gem ‘capybara’
gem ‘launchy’
gem ‘factory_girl_rails’
gem ‘database_cleaner’
end

group :development, :test do
gem ‘rspec-rails’
gem ‘guard-rspec’
gem ‘rb-inotify’, :require => false
gem ‘libnotify’ if RUBY_PLATFORM =~ /linux/i
gem ‘rb-fsevent’, :require => false if RUBY_PLATFORM =~ /darwin/i
gem ‘growl’ if RUBY_PLATFORM =~ /darwin/i
gem ‘annotate’
gem ‘better_errors’
gem ‘binding_of_caller’
gem ‘meta_request’
gem ‘bullet’
end
gem ‘rubber’
gem ‘open4’

I was able to install those gems ok with bundler but try removing gem ‘strong_parameters’ like I was saying in the previous post and see if that helps.