errors with rake db:create command in ruby on rails - ruby-on-rails

when I have typed command rake db:create, following errors were displayed on terminal
rake aborted!
cannot load such file -- active_support/core_ext/class/inheritable_attributes
/home/shashikant/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
/home/shashikant/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `block in require'
/home/shashikant/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
/home/shashikant/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
/home/shashikant/.rvm/gems/ruby-1.9.3-p385/gems/supermodel-0.1.4/lib/supermodel.rb:5:in `<top (required)>'
/home/shashikant/.rvm/gems/ruby-1.9.3-p385#global/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `require'
/home/shashikant/.rvm/gems/ruby-1.9.3-p385#global/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
/home/shashikant/.rvm/gems/ruby-1.9.3-p385#global/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `each'
/home/shashikant/.rvm/gems/ruby-1.9.3-p385#global/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `block in require'
/home/shashikant/.rvm/gems/ruby-1.9.3-p385#global/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `each'
/home/shashikant/.rvm/gems/ruby-1.9.3-p385#global/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `require'
/home/shashikant/.rvm/gems/ruby-1.9.3-p385#global/gems/bundler-1.2.3/lib/bundler.rb:128:in `require'
/home/shashikant/railsproject/online_exams_system/config/application.rb:7:in `<top (required)>'
/home/shashikant/railsproject/online_exams_system/Rakefile:5:in `require'
/home/shashikant/railsproject/online_exams_system/Rakefile:5:in `<top (required)>'
/home/shashikant/.rvm/gems/ruby-1.9.3-p385/bin/ruby_noexec_wrapper:14:in `eval'
/home/shashikant/.rvm/gems/ruby-1.9.3-p385/bin/ruby_noexec_wrapper:14:in `<main>'
(See full trace by running task with --trace)

I got the answer just downloded the file "inheritable_attributes.rb" form github and other file name will be shown after u add the file in specified directory and run the command rake db:migrate

Related

rails db:setup error : rails aborted ? I am using postgresql and postico 2

I am newbie with Rails and here is my problem. I setup a new rails program named freelancer02 and in the file database.yml I saw the database : freelancer02_development and database : freelancer02_test
So I think, I could run this command to setup a new database
rails db:setup
But it gave me this error
rails aborted!
LoadError: incompatible library version - /Users/anhbui/.gem/ruby/3.1.2/gems/pg-1.4.5/lib/pg_ext.bundle
/Users/xxx/.gem/ruby/3.1.2/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/Users/xxx/.gem/ruby/3.1.2/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/Users/xxx/.gem/ruby/3.1.2/gems/pg-1.4.5/lib/pg.rb:49:in `block in <module:PG>'
/Users/xxx/.gem/ruby/3.1.2/gems/pg-1.4.5/lib/pg.rb:37:in `block in <module:PG>'
/Users/xxx/.gem/ruby/3.1.2/gems/pg-1.4.5/lib/pg.rb:42:in `<module:PG>'
/Users/xxx/.gem/ruby/3.1.2/gems/pg-1.4.5/lib/pg.rb:6:in `<main>'
/Users/xxx/.gem/ruby/3.1.2/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/Users/xxx/.gem/ruby/3.1.2/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/Users/xxx/.gem/ruby/3.1.2/gems/bundler-2.3.26/lib/bundler/runtime.rb:60:in `block (2 levels) in require'
/Users/xxx/.gem/ruby/3.1.2/gems/bundler-2.3.26/lib/bundler/runtime.rb:55:in `each'
/Users/xxx/.gem/ruby/3.1.2/gems/bundler-2.3.26/lib/bundler/runtime.rb:55:in `block in require'
/Users/xxx/.gem/ruby/3.1.2/gems/bundler-2.3.26/lib/bundler/runtime.rb:44:in `each'
/Users/xxx/.gem/ruby/3.1.2/gems/bundler-2.3.26/lib/bundler/runtime.rb:44:in `require'
/Users/xxx/.gem/ruby/3.1.2/gems/bundler-2.3.26/lib/bundler.rb:186:in `require'
/Users/xxx/Desktop/Rails/freelancer02/config/application.rb:7:in `<main>'
/Users/xxx/Desktop/Rails/freelancer02/Rakefile:4:in `require_relative'
/Users/xxx/Desktop/Rails/freelancer02/Rakefile:4:in `<main>'
/Users/xxx/.gem/ruby/3.1.2/gems/railties-7.0.4/lib/rails/commands/rake/rake_command.rb:20:in `block in perform'
/Users/xxx/.gem/ruby/3.1.2/gems/railties-7.0.4/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/Users/xxx/.gem/ruby/3.1.2/gems/railties-7.0.4/lib/rails/command.rb:51:in `invoke'
/Users/xxx/.gem/ruby/3.1.2/gems/railties-7.0.4/lib/rails/commands.rb:18:in `<main>'
/Users/xxx/.gem/ruby/3.1.2/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/Users/xxx/.gem/ruby/3.1.2/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
bin/rails:4:in `<main>'
(See full trace by running task with --trace)
I also ran this command
rake db:reset RAILS_ENV=test
but it still gave me the error above
When I check by ruby -v and rails -v, my version is ruby 3.1.2 and rails 7.0.4
Could you please give me some advices ? Thank you very much for your time.

Cannot use heroku run rake db:migrate in rails?

sahilrd07:~/workspace/sample2 (filling-in-layout) $ heroku run rake db:drop
Running rake db:drop on limitless-coast-42827... up, run.4760
rake aborted!
NameError: uninitialized constant Sass::Script
/app/vendor/bundle/ruby/2.2.0/gems/sass-rails-5.0.1/lib/sass/rails/helpers.rb:11:in `<top (required)>'
/app/vendor/bundle/ruby/2.2.0/gems/sass-rails-5.0.1/lib/sass/rails.rb:8:in `require'
/app/vendor/bundle/ruby/2.2.0/gems/sass-rails-5.0.1/lib/sass/rails.rb:8:in `<top (required)>'
/app/vendor/bundle/ruby/2.2.0/gems/sass-rails-5.0.1/lib/sass-rails.rb:1:in `require'
/app/vendor/bundle/ruby/2.2.0/gems/sass-rails-5.0.1/lib/sass-rails.rb:1:in `<top (required)>'
/app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:76:in `require'
/app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
/app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:72:in `each'
/app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:72:in `block in require'
/app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:61:in `each'
/app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:61:in `require'
/app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler.rb:134:in `require'
/app/config/application.rb:7:in `<top (required)>'
/app/Rakefile:4:in `require'
/app/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
You should enter your Heroku server and run the command there:
$ heroku console
Ruby console for heroku-project-name
>> ActiveRecord::Migration.drop_table(:table_name)
As described here, you can also drop the db from your heroku dashboard. From the linked post:
Now it's also possible to reset the database through their web interface.
Go to dashboard.heroku.com select your app and then you'll find the database under the add-ons category, click on it and then you can reset the database.

"undefined method `require_rspec_core' for RSpec::Support:Module" during running migration

In Rails, during running migration I get rake aborted!
NoMethodError: undefined method `require_rspec_core' for RSpec::Support:Module
Console log:
rake db:create RAILS_ENV=production
rake aborted!
NameError: uninitialized constant Rails::Generators::Actions
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/railties-4.1.9/lib/rails/generators/base.rb:17:in `<class:Base>'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/railties-4.1.9/lib/rails/generators/base.rb:15:in `<module:Generators>'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/railties-4.1.9/lib/rails/generators/base.rb:11:in `<module:Rails>'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/railties-4.1.9/lib/rails/generators/base.rb:10:in `<top (required)>'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/my_zipcode_gem-0.1.3/lib/my_zipcode_gem.rb:1:in `<top (required)>'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:76:in `require'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:72:in `each'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:72:in `block in require'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:61:in `each'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:61:in `require'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/bundler-1.9.4/lib/bundler.rb:134:in `require'
/var/www/my-attorney-on-demand-web/config/application.rb:14:in `<top (required)>'
/var/www/my-attorney-on-demand-web/Rakefile:4:in `require'
/var/www/my-attorney-on-demand-web/Rakefile:4:in `<top (required)>'
/home/ubuntu/.rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15:in `eval'
/home/ubuntu/.rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15:in `<main>'
(See full trace by running task with --trace)

rake aborted! LoadError: cannot load such file -- test/unit/error

I am trying to install insoshi in Rails 3.2.21 with ruby 1.9.3 every thing gone good but now I am stopped with an error when I try $rake gems:install it gives an error
rake aborted!
LoadError: cannot load such file -- test/unit/error
C:/Sites/insoshi/vendor/rails/activesupport/lib/active_support/dependencies.rb:1
53:in `block in require'
C:/Sites/insoshi/vendor/rails/activesupport/lib/active_support/dependencies.rb:5
21:in `new_constants_in'
C:/Sites/insoshi/vendor/rails/activesupport/lib/active_support/dependencies.rb:1
53:in `require'
C:/Sites/insoshi/vendor/rails/activesupport/lib/active_support/deprecation.rb:22
4:in `<top (required)>'
C:/Sites/insoshi/vendor/rails/activesupport/lib/active_support/dependencies.rb:1
53:in `block in require'
C:/Sites/insoshi/vendor/rails/activesupport/lib/active_support/dependencies.rb:5
21:in `new_constants_in'
C:/Sites/insoshi/vendor/rails/activesupport/lib/active_support/dependencies.rb:1
53:in `require'
C:/Sites/insoshi/vendor/rails/activesupport/lib/active_support.rb:37:in `<top (r
equired)>'
C:/Sites/insoshi/vendor/rails/railties/lib/tasks/misc.rake:11:in `<top (required
)>'
C:/Sites/insoshi/vendor/rails/railties/lib/tasks/rails.rb:4:in `load'
C:/Sites/insoshi/vendor/rails/railties/lib/tasks/rails.rb:4:in `block in <top (r
equired)>'
C:/Sites/insoshi/vendor/rails/railties/lib/tasks/rails.rb:4:in `each'
C:/Sites/insoshi/vendor/rails/railties/lib/tasks/rails.rb:4:in `<top (required)>
'
C:/Sites/insoshi/Rakefile:10:in `<top (required)>'
(See full trace by running task with --trace)
I am totally new with rails. hope for help

Rake gets aborted with error: no such file to load -- openssl

I keep getting openssl issues on my Mac. I am completely perplexed by the error messages when I try to issue rails tasks. What might be the issue?
I definitely have openssl on my machine because when I type it in the terminal, it opens an openSSL> session.
Every time I try the following: RAILS_ENV=development rake db:migrate
I get the below error:
rake aborted!
no such file to load -- openssl
(See full trace by running task with --trace)
When I type the above with --trace option, it shows an error which is listed below.
When I try to launch rails server by typing rails s I get the below error:
$> rails s
/usr/local/rvm/gems/ruby-1.9.2-p320/gems/net-ssh-2.6.6/lib/net/ssh/transport/openssl.rb:2:in `require': no such file to load -- openssl (LoadError)
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/net-ssh-2.6.6/lib/net/ssh/transport/openssl.rb:2:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/net-ssh-2.6.6/lib/net/ssh/buffer.rb:2:in `require'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/net-ssh-2.6.6/lib/net/ssh/buffer.rb:2:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/net-ssh-2.6.6/lib/net/ssh/transport/algorithms.rb:1:in `require'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/net-ssh-2.6.6/lib/net/ssh/transport/algorithms.rb:1:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/net-ssh-2.6.6/lib/net/ssh/transport/session.rb:7:in `require'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/net-ssh-2.6.6/lib/net/ssh/transport/session.rb:7:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/net-ssh-2.6.6/lib/net/ssh.rb:10:in `require'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/net-ssh-2.6.6/lib/net/ssh.rb:10:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/net-ssh-gateway-1.2.0/lib/net/ssh/gateway.rb:2:in `require'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/net-ssh-gateway-1.2.0/lib/net/ssh/gateway.rb:2:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/capistrano-2.14.2/lib/capistrano/configuration/connections.rb:2:in `require'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/capistrano-2.14.2/lib/capistrano/configuration/connections.rb:2:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/capistrano-2.14.2/lib/capistrano/configuration.rb:5:in `require'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/capistrano-2.14.2/lib/capistrano/configuration.rb:5:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/capistrano-2.14.2/lib/capistrano.rb:3:in `require'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/capistrano-2.14.2/lib/capistrano.rb:3:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/bundler-1.3.4/lib/bundler/runtime.rb:72:in `require'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/bundler-1.3.4/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/bundler-1.3.4/lib/bundler/runtime.rb:70:in `each'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/bundler-1.3.4/lib/bundler/runtime.rb:70:in `block in require'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/bundler-1.3.4/lib/bundler/runtime.rb:59:in `each'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/bundler-1.3.4/lib/bundler/runtime.rb:59:in `require'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/bundler-1.3.4/lib/bundler.rb:132:in `require'
from /Users/imtiazahmad/scripts/xxx-patchtrack/config/application.rb:7:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.6/lib/rails/commands.rb:53:in `require'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.6/lib/rails/commands.rb:53:in `block in <top (required)>'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.6/lib/rails/commands.rb:50:in `tap'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.6/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Try rebuilding ruby with ssl support:
port install openssl +universal
rvm install 1.9.2 --with-openssl-dir=/opt/local

Resources