Rails plugin: undefined method 'mattr_accessor' for Sentry:Module - ruby-on-rails

I'm looking at an existing Rails project and trying to see what rake tasks exist by running rake -T. However, when I run that I get:
(in /var/www/project)
rake aborted!
undefined method `mattr_accessor' for Sentry:Module
/var/www/project/Rakefile:10
(See full trace by running task with --trace)
vendor/plugins/sentry/tasks/sentry.rake has nothing called mattr_accessor in it. What is this error message referring to?

(See full trace by running task with --trace)
Did you try running the rake command with the --trace option?

I'm afraid this resolved itself while I was working on other issues. I'm not sure exactly what the problem was, but I believe it had to do with outdated/conflicting versions of plugins and gems.

Related

Rake doc:app fails after upgrading to Ruby 2.1.1 and Rails 4.1

I use the command
rake doc:app
to generate some rudimentary documentation for my rails app. It's always worked fine in the past. Yesterday I upgraded by app from Ruby 1.9.3 to 2.1.1, and Rails 3.2 to 4.1. Everything is working fine with the app, so I went to regenerate documentation for the first time in a few weeks, and it failed. I ran the command above and got the following error message:
rake aborted!
Don't know how to build task 'README.rdoc'
/home/vagrant/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `eval'
/home/vagrant/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => doc:app => doc/app/index.html
(See full trace by running task with --trace)
I believe this is the standard error message rake delivers for a task it doesn't know. Like if I ran
rake foo
It gives the exact thing, but with 'foo' instead of 'README.rdoc'. I get the same results when I run
bundle exec rake doc:app
I'm using rake 10.2.2. Any idea what's going on?
Create a README.rdoc in the project root folder. You might have removed it or replaced it with a README with another filetype extension.

Rake commands aborted / Ruby Rails

I'm pretty sure I should be posting this here, but feel free to correct me if this belongs on something like Superuser.
Trying to setup this Ruby/Javascript app https://github.com/jamesu/tubehub - on my freshly formatted Linode.
Running: Ubuntu v10.04 LTS, Ruby v1.8.8dev, Rails v3.2.9, SQLite v3.6.22.
I appear to be close to successfully installing and launching this app after much troubleshooting, but the last bit I can't figure out yet is the "aborted" errors I get when running the rake commands, as shown in the README documentation.
root#li570-120:~/tubehub# rake db:seed
rake aborted!
/root/tubehub/util.rb:8: undefined (?...) sequence: /^(.*?)((?<!&)#|\#)(.*)$/
/root/tubehub/util.rb:9: undefined (?...) sequence: /(?:\#)(?<!&#)(?:\#)*(.*)$/
/root/tubehub/core.rb:37
/root/tubehub/core.rb:36:in `each'
/root/tubehub/core.rb:36
/root/tubehub/Rakefile:2
Tasks: TOP => db:seed => environment
(See full trace by running task with --trace)
root#li570-120:~# rake db:load
rake aborted!
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
(See full trace by running task with --trace)
This is my first foray into Ruby specifically, filtered through some "rake" docs but wasn't sure what I was looking at.
Any suggestions?
I'll add an answer.
Please use rake db:schema:load instead
As per Anatoliy Kukul's suggestion - "rake db:schema:load" got everything working correctly, and loaded all of the tables needed into the local database.
worked a treat - thanks for the clarification!

Ruby on Rails Rake assets:precompile error - Command failed with status (1) - CScript Error: Execution of the Windows Script Host failed

Okay so time after time we've all seen question about Rake assets:precompile error. I've tried multiple methods, I looked at the following SO question Ruby on Rails Rake assets:precompile error and tried multiple methods of even doing the following: config.assets.compile = true and then running rake assets:precompile --trace RAILS_ENV=production. However I noticed that when I tried to do the following:
rake assets:precompile RAILS_ENV=production I got the following error:
rake aborted!
CScript Error: Execution of the Windows Script Host failed. (0x800A0007)
C:\Users\home\Desktop>cd MIUK_Portal
C:\Users\home\Desktop\MIUK_Portal>rake assets:precompile
RAILS_ENV=production C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe
C:/RailsInstaller/Ruby1.9.3/bin/rake assets:precompile:all
RAILS_ENV=production RAILS_GROUPS=assets rake aborted! 795: unexpected
token at
'C:\Users\home\AppData\Local\Temp\execjs20121221-5484-1atk9yx.js(2, 3)
Microsoft JScript runtime error: Out of memory
' (in
C:/Users/home/Desktop/MIUK_Portal/app/assets/javascripts/application.js)
Tasks: TOP => assets:precompile:primary (See full trace by running
task with --trace) rake aborted! Command failed with status (1):
[C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe C...]
Tasks: TOP => assets:precompile (See full trace by running task with
--trace)
Has anyone encountered this issue? How do you overcome this?
Update
Okay apparently from looking at the error it clearly is stating that
:\Users\home\AppData\Local\Temp\execjs20121221-5484-1atk9yx.js(2, 3)
Microsoft JScript runtime error: Out of memory
So I'm now wondering how to resolve this? Any ideas? Further to this I noticed that someone did encounter the similar issue: CS Script issue but this was unresolved:
So I am asking if anyone out there has had the same issue.
This was what I did, and it worked for me. I installed node.js first in my system, and then ran the following command bundle exec rake assets:precompile.
I was able to solve this issue by transferring the project into a Linux environment (Ubuntu) and running the bundle exec rake assets:precompile. It appeared to work, I believe this sort of issue is something to do with windows. If starting any kind of development to do with RoR stick to Linux.

New Deploy to Production, Rake db:migrate fails

Trying to deploy a new app to production. Build the server from a base CentOS.
However, when I try to run the rake to migrate the database, i get the following error
[root#tatp tatp_store]# bundle exec rake db:migrate
rake aborted!
uninitialized constant ActiveShipping::Base
(See full trace by running task with --trace)
[root#tatp tatp_store]#
I through it might be a similar issue to the DSL issue but similar fixes do not work.
Thanks!
This issue was caused by a bug in the Spree Active Shipping, issue #26 which has been fixed in build 9d4af80

Installing migrations from engine won't work

I created a new engine in Rails 3.1.3 and apparently there's that rake task that copies over all migrations. I tried following rake abc:install:migrations which threw:
rake aborted!
Don't know how to build task 'abc:install:migrations'
(See full trace by running task with --trace)
I also tried rake abc_engine:install:migrations with the same result.
Then I read bundle exec rake railties:install:migrations or bundle exec rake railties:install:migrations FROM=abc_engine should do the trick too but no success. Nothing was copied even though no error was thrown.
My migrations are located in db/migrate/ within the engine folder and I ran all commands above from spec/dummy/
Does anyone know how to use this new rake task in order to copy migrations from the engine?
I ran this instead:
rake railties:install:migrations
And my migrations were copied from the engine.
Hope this helps.
I finally got found/got lucky with my (similar) issue. For the first error, it just disappeared, not sure why. Then I figured out that I didn't created the migrations using the usual file name format, so the ActiveRecord::Migrator.migrations method was ignoring them.
If the app you're mounting the engine to doesn't already have ActiveRecord (i.e. you're introducing ActiveRecord to your host app for the first time by mounting the engine), you can get this error as well. Specifically, you'll get this error if you don't have require "active_record/railtie" in your application.rb, or if it's commented out. That line is what enables the rake railties:install:migrations task, which is defined here. rake railties:install:migrations is, in turn, called by the rake abc_engine:install:migrations task here.
Tl;dr: try adding require "active_record/railtie" to your application.rb if it's not already there.

Resources