Globalize2 problems, undefined method `translates' for? - ruby

I've set up Globalize2 on a rails app however I'm getting the following error when I put translates on the model:
undefined method `translates' for
Is anyone else getting this error? It's on rails 3 by the way.

You will have to use globalize3 if you run rails3.
You can download it from https://github.com/svenfuchs/globalize3 or by adding
gem "globalize3"
to you Gemfile and running bundle install.

Related

undefined method `reset_all` for nil

F
An error occurred in an `around(:example)` hook
NoMethodError: undefined method `reset_all' for nil:NilClass
occurred at /usr/lib/ruby/vendor_ruby/rspec/mocks.rb:22:in `teardown'
I'm currently trying to run a ruby test suite, but running into issues when calling rspec spec/. I'm getting the above traceback. Any ideas as to what might cause this? I've tried updating rspec to no avail.
Any debugging tips are also appreciated.
Looks like it was simply a matter of an outdated ruby version!

Why did my minitest/pride alias break?

Silly, cosmetic question for everyone.
I take pride in my testing. That is, I like to use minitest/pride. Unfortunately, not everyone on my team is a fan, so I have activated it in the past using the command line instead of modifying the code by setting an alias to this:
RUBYOPT=-rminitest/pride bex rake`
(bex is an alias to bundle exec, and the default rake task runs our tests.)
Recently, we updated the ruby version of our project from 1.9.3 to 2.2.0. This has broken my alias, and now when I try to run it, I get this error instead:
/Users/cf5455/.rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- minitest/pride (LoadError)
from /Users/cf5455/.rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
My best guess as to why this is happening is that MiniTest was changed since our last Ruby version and pride has been renamed or moved, but I have not been successfully able to Google its new name or location.
Does someone know a way that I can fix my arguments to get pride working again?
Duplicated your error by switching to ruby 2.3.0. I just ran the tests before installing any gems.
I managed to get the tests running with your alias by simply doing a gem minitest install. Not sure if your problem is caused by the same reason since I'm using rbenv for managing my rubies and gems but it does feel like you are having a package management issue. Hope this helps.

Sinatra - undefined method `join' for #<String> - after removing Gemfile.lock

I tried to update the Ruby version of a Sinatra website I am working on to 2.1.3. When I tried to bundle I had some errors. Then I removed the Gemfile.lock and bundle install proceeded. But when I ran the website I noticed some thing like
NoMethodError at /auth/login
undefined method `join' for #<String:0x000000062d3830>
My observations are as below.
Downgraded to Ruby 2.1.2 - problem preserved
Checked out the project as it was before (Ruby 2.1.2 with the old Gemfile.lock) worked
The error showed up with a yield_content(:head) tag.
Removed all yield_content tags
Error showed up rendering the slim file for the page - slim :index, :layout => :layout, :locals => body_locals
What could be the error? I created a diff off the state of the Gemfile.lock before and after: https://gist.github.com/ziyan-junaideen/fb903abbdafdc2d4a02f
Error output from the terminal: https://gist.github.com/ziyan-junaideen/54bff4f05a5a7beeedff
I thought it was some SLIM error and downgraded Slim to 2.0.3 which used to be before the bundle install, but had no luck.
Any suggestion is highly appreciated.
Thanks
I have solved it by reinstalling slim and temple in versions slim: 2.0.3 and temple: 0.6.8,
it's probably in temple, 'cos downgrading slim is not enough
I've got this error as well.
After some research I've found that it is happening because 'output buffer' for template rendering is an instance variable (its default name is #_out_buf), thus it is overwritten when each (sub)template rendering completes (because partials are being rendered in the same scope as main template)
There are a few ways to fix this without downgrading sinatra/slim/temple:
Make default outvar value equals to _out_buf (local variable) # lib/sinatra/base.rb#L814
Pass an outvar option to slim method like this: == slim :sub_template, outvar: '_out_buf'
I've also opened an issue at sinatra's repo at github: https://github.com/sinatra/sinatra/issues/939 (let's see what authors will say about this)

Undefined method Zip::ZipOutputStream.write_buffer on Heroku

I'm making a basic Sinatra app to play around with the Passbook gem.
My app runs fine on localhost, but when I try and run it on Heroku I get this error message:
/app/vendor/bundle/ruby/2.0.0/gems/passbook-0.2.1/lib/passbook/pkpass.rb:122:in `outputZip'
/app/vendor/bundle/ruby/2.0.0/gems/passbook-0.2.1/lib/passbook/pkpass.rb:60:in `stream'
/app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.4/lib/sinatra/base.rb:1593:in `call'
NoMethodError - undefined method `write_buffer' for Zip::ZipOutputStream:Class:
This happens when I call the line passbook.stream.string in my app file.
I don't think Passbook is the problem here - it seems that the class method write_buffer exists in the version of Zip::ZipOutputStream on my local machine but isn't there on Heroku. Why is this? How can I get around it?
I've tried including both zip and rubyzip in my Gemfile, individually and at the same time, and neither of them solve the issue.
Whenever I see something like this, I always ask myself Do you have Dev/Prod parity?.
So:
What Ruby version do you use locally, and does it differ from what you're using on Heroku?
Do you specify a Ruby version in your Gemfile?
How do you run locally? Do you use bundle exec to ensure you run in the same way, with the same gems?
Finally figured it out.
When I ran ruby app.rb, things worked locally, but when I ran bundle exec ruby app.rb, I got the same error as I did on heroku.
I upgraded to the latest version of passbook (which was just updated today to handle the latest changes to rubyzip), but things still didn't work.
Turns out I needed to remove gem 'zip' from my Gemfile and just include gem 'rubyzip' - previously I had both.

Ruby on Rails 3 : Playing with Spree

I am running SPREE.
I am already follow the tutorial but when I reach this line, the warning is show up.
I am already googling it but there is no solution.
$ bundle exec rake spree_sample:load
[DEPRECATION WARNING] Nested I18n namespace lookup under "activerecord.attributes.order" is no longer supported
Help me please.. :)
This is a known issue with Spree and will be fixed when Rails 3.2 comes out. Please just disregard this warning.

Resources