I am getting a ton of warnings from ruby vips when running my test suit. Not causing any issues... just really annoying. Does anyone know the root issue here or know how to suppress the ruby vips warnings?
ruby '3.1.2'
gem 'rails', '~> 7.0.4'
gem 'image_processing', '~> 1.2' # ruby vips is a depency here. Gemfile.lock has ruby-vips 2.1.4 installed
When running tests (mini tests) I get this. Has anyone else seen this?
/Users/clarktaylor/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/ruby-vips-2.1.4/lib/vips.rb:51: warning: already initialized constant GLib::G_FREE
/Users/clarktaylor/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/ruby-vips-2.1.4/lib/vips.rb:51: warning: previous definition of G_FREE was here
/Users/clarktaylor/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/ruby-vips-2.1.4/lib/vips.rb:59: warning: already initialized constant GLib::LOG_FLAG_RECURSION
...
The warning go on for about 80 lines. Any help would be greatly appreciated!
Looks like it was an issue when setting the defaults for the image_processing gem. The default used supposed to be image_magick... however with rails 7, the default for active storage is ruby-vips. I tried adding config.active_storage.variant_processor = :mini_magick to config/application.rb but it made no difference.
HOWEVER, when I added config.active_storage.variant_processor = :mini_magick to config/environments/test.rb, it fixed the issue.
I went ahead and added that line to ALL my environment files just to be safe.
NOTE: ruby-vips is much faster than image_magick so it's probably best to keep ruby-vips. If you keep ruby-vips however, it does have a different syntax for creating variants
Related
I upgraded our app to Rails 6.1.4.4 and Ruby 3.0.2. I have this old gem
gem 'acts_as_commentable'
Locked at version 4.0.2. The gem does not appear to be supported anymore, which is a shame because when I start up my app or console, I now get this error
$ rails c
Your Gemfile lists the gem rspec-rails (>= 0) more than once.
You should probably keep only one of them.
Remove any duplicate entries and specify the gem only once.
While it's not a problem now, it could cause errors if you change the version of one of them later.
/Users/myuser/.rvm/gems/ruby-3.0.2/gems/hash_dot-2.5.0/lib/hash.rb:19:in `method_missing': undefined method `arity' for {:as=>:commentable, :dependent=>:destroy}:Hash (NoMethodError)
from /Users/myuser/.rvm/gems/ruby-3.0.2/gems/activerecord-6.1.4.4/lib/active_record/associations/builder/association.rb:53:in `build_scope'
from /Users/myuser/.rvm/gems/ruby-3.0.2/gems/activerecord-6.1.4.4/lib/active_record/associations/builder/association.rb:47:in `create_reflection'
from /Users/myuser/.rvm/gems/ruby-3.0.2/gems/activerecord-6.1.4.4/lib/active_record/associations/builder/association.rb:32:in `build'
from /Users/myuser/.rvm/gems/ruby-3.0.2/gems/activerecord-6.1.4.4/lib/active_record/associations.rb:1458:in `has_many'
from /Users/myuser/.rvm/gems/ruby-3.0.2/gems/acts_as_commentable-4.0.2/lib/commentable_methods.rb:58:in `acts_as_commentable'
…
Is there any simple replacement for this gem or way to monkey-patch this error so I can start up the app?
Looking over the forks, I found this one that appears to work for me using Rails 6.0.6 and Ruby 3.0.5.
https://github.com/alazycoder101/acts_as_commentable.git
I have not tested it extensively yet, but at least the basic functionality seems to be working for me. Hope this helps.
For clarity, to use that fork you would use the following line in your Gemfile:
gem 'acts_as_commentable', git: 'https://github.com/alazycoder101/acts_as_commentable.git'
I've been using the yaml_db gem for a long time to dump the database to yaml and then reload it later if needed. On a fresh project, though, on rake db:load I got the error message:
NoMethodError: undefined method `load_documents' for Psych:Module
Did you mean? load_stream
/Users/user/.rvm/gems/ruby-2.5.0/gems/yaml_db-0.6.0/lib/yaml_db.rb:61:in `load_documents'
I am submitting the solution I finally came up with as an answer, but I'm not really happy with it. If anyone has a better solution or a suggestion of something better than the yaml_db gem for dumping and reloading the database, I'd be happy to listen.
I'm running Rails 5.1.4 on Ruby 2.5.0
The solution I came up with was to put the 'psych' gem in my Gemfile before yaml_db and set it to an earlier release:
gem 'psych', '~> 2.2.1'
gem 'yaml_db'
This issue is caused by load_documents being deprecated in Psych and finally removed in ruby 2.5. There's an open PR on yaml_db that fixes this issue, so hopefully future versions will not require you to use this work-around.
Your current solution is probably the easiest for now (short of downgrading your ruby version, which is probably a worse idea).
I use Ruby Mine 6.3, ruby 2.1 and Rails 4.0.3.
Which gems need to debug application with Ruby Mine, I tried use these gems:
gem 'debugger'
gem 'debugger-xml'
But application crashed with exit code 127 at breakpoint, and print this:
.rvm/gems/ruby-2.1.0/extensions/x86_64-linux/2.1.0/debugger-1.6.6/ruby_debug.so:
undefined symbol: rb_vm_get_sourceline
UPDATE
I updated RubyMine to 6.3.1, dropped 'debugger', 'debugger-xml' (in Gemfile only 'ruby-debug-ide') and Debugging works!
I advise bunch of "better_errors" and "binding_of_caller".
You can read about this here: https://github.com/charliesome/better_errors
I'm usually use this gems:
https://gist.github.com/MrEmelianenko/11078561
To enhance your console, use pry-rails, better with pry-doc.
To debug in program, like using breakpoint, step in/over, you can use pry-byebug or pry-debugger.
p.s. this is my way to debug rails app in terminal, I'm not sure if it is ok with Ruby Mine. Hope this can help.
I always liked pry. And its very useful with easy to learn screencast
This is my debugging stack for my Ruby 2 & Rails 3/4 apps ;)
group :development do
gem 'pry'
gem 'pry-nav'
gem 'pry-rescue'
gem 'pry-stack_explorer'
gem 'pry-doc'
end
Hope it helps
As you mentioned, you need ruby-debug-ide, but not debugger or debugger-xml.
For Rubymine/IDea + Ruby plugin with Ruby 2.0/2.1, also try the debase gem along with ruby-debug-ide to speed up debugging. Earlier versions had some trouble, but it works well, as of 2014-04-21.
You already found your answer but I'd like to add small notes
Rubymine has an issue with the debugger gem, or probably it's the gems clashing(maybe), rubymine uses fast-debugger (ruby-debug-ide) and I think it doesn't like debugger, old versions suggested adding debugger-xml but from my trials that didn't really work so well, and current version kinda tolerates debugger a bit, but sometimes it freezes during breakpoints.
My teammates use debugger, so it's pushed to the repo, what I do is whenever I need to debug I just delete the debugger line from my Gemfile and wait for rubymine to detect that Gemfile change (about a second or two) and start my debugging session, I only put it back when I check the diff before pushing.
I've googled this to death and I'm just going around in circles.
I'm on a Windows Server 2008r
I installed and put the following in my Gemfile
gem 'ruby-odbc' # I think the version is the.9999 one?
gem 'tiny_tds', "~> 0.6.1"
gem 'activerecord-sqlserver-adapter' # I've tried a few versions of this 3.2.8 and 4.0
I get varying errors depending on how many times i've bundle installed or updated
Errors include activesupport and activerecord versions not found. They are installed
Or I get alias_method errors.
Can someone just point me in the right direction of what I should do. Some discussions seem to think that there is nothing that works at the moment. Would downgrading to an older Rails work? If so how and which version?
activerecord-sqlserver-adapter hasn't been released for Rails 4.0 yet but the gem is 95% ready. You can use put it in your Gemfile like this:
gem 'activerecord-sqlserver-adapter', github: 'rails-sqlserver/activerecord-sqlserver-adapter'
For a description of the outstanding work take a look at Failed Tests & Segfault on this pull request.
I am using the fog gem to send carrierwave uploads to an AWS S3 bucket. That seems to be working fine, but when I try to run my cucumber tests I get:
You are using Excon 0.6.6. WebMock supports version >= 0.9.6
I have moved fog out of the test group in the gemfile (it's only in development and production). I've looked around for other people have thing problem, but I haven't been able to find anything.
My goal really would be to not use fog at all in the test suite, but just use the local file system.
It turns out that I was using an old version of fog. I had:
gem 'fog'
In my gemfile when I needed to have:
gem "fog", "~> 1.12.1"
That fixed this problem.
Yep, I was about to chime in and let you know as much. I think a bundle update fog would also do the trick (without needing to lock to anything in particular or change the gemfile). Glad you were able to get yourself back on track so easily though.