I have installed Ruby Version 3.1.2p20 and Rails Version Rails 7.0.4.
So I want to create new rails app and when I type rails new test-app I am getting error related to UTF-8. Does anyone has any recommendation or can help me setup Rails app correctly? Thanks in advance.
I tried many solutions, but I am thinking I should reinstall it all. Also I checked PATH and it is correctly added.
I am not exactly sure what is the issue here with Ruby 3.1 in windows. But as we know that Ruby's default encoding since 2.0 is UTF-8. This means that Ruby will treat any string as a UTF-8 encoded string unless you tell it explicitly that it's encoded differently so I am guessing there might be something wrong in pathname.rb file.
I faced the same issue in windows and I resolved it by downgrading ruby from 3.1 to 2.7 and it worked for me.
Related
Hey guys so I am new to everything including computers I don't know squat, nothing! I am recently trying to take ruby on rails on lynda.com. I have ran into many problems with using ruby and downloading rails I have followed allot of helpful tips which have helped but I cannot seem to get out of this loop for 6 hrs already.
I am using ruby 2.2.4 ,rails 2.4.5.1 on the other hand I don't know how to use it and when I check
rails -v
this pops up
the system cannot find the path specified
I am using windows 10 by the way. So can someone please help in detail and hoping you have the patience to work with someone who knows nothing. Thanks in advance.
I assume that you need to install ruby and rails on your windows 10 machine.
You can use rails installer for installing ruby and all other stuff related to ruby and rails using a single installation.
We have an application which is currently on Rails version 2.3.12 and Ruby version 1.8.7. We want to update our application to Rails 4.0 and Ruby 2.1.0. We have around 200 models and 150 controllers.
I would like to know how big an effort is it to undergo the upgrade process. Also can you provide steps which can be followed for the upgrade. Should we first upgrade Ruby and then Rails or vice-versa?
What you want to achieve is gonna be an epic effort. I can't provide you the step by step instructions because it's impossible to cover all the cases in a single answer.
I recommend to not upgrade Ruby and Rails in parallels, but in small steps.
The complexity of the upgrade itself is huge, but it's not impossible as long as you have a reasonable test coverage of you application. I really hope you have tests. If you don't, then you can't even think to start an upgrade like this and you first need to ensure a minimum coverage for the product.
My suggestion is to follow this roadmap
Upgrade Ruby from 1.8.7 to 1.9.3. Rails 2.3 is supposed to be compatible with Ruby 1.9 and you'll get the benefit of a more recent Ruby version. In fact, several gems have dropped support for Ruby 1.8.
Leave the app settle and run for a while, just to make sure you can find and fix incompatibilities. Every time you find an issue, reproduce it with a test, then fix it.
Upgrade Rails from 2.3 to 3.0.
Same as point 2.
Upgrade Rails from 3.0 to the latest 3.x version.
Same as point 2.
Upgrade Ruby from 1.9.3 to 2.0. The upgrade should be trivial.
Same as point 2.
Upgrade Rails from 3.x to the latest version
A few notes
The reason I suggested you to not upgrade from Rails 2.3 directly to 4, it's because it's almost impossible.
The reason I suggested you to not upgrade form Rails 2.3 directly to the latest 3.x, it's because from 3.0 to 3.x there is the asset pipeline new feature that is gonna cause you several headaches. It's better to handle this step separately and not in a big upgrade.
Ruby 1.9 handles encoding differently than Ruby 1.8. Rails 2.3 is not well prepared for this.
The issues often lead to hard errors, and may occur at unexpected places (like when you want to show a error message)
A good (or scary) overview is on this blog entry:
http://www.rvdh.de/2010/01/06/why-you-cant-run-rails-23-apps-on-ruby-19/
I also lost a lot of time trying to bring Rails 2.3.x to work with Ruby 1.9.x
(Maybe it is possible if you are always use plain ascii)
So you need first update to Rails 3.0 and then to Ruby 1.9.3 (or both at the same time)
The asset pipeline is nice when it works, but upgrading is difficult enough.
So I would just disable it until you are on Rails 4.0.
There is a lot changed with the views, like form_for helper.
It is good when you have tests that render each view at least once. You then will get deprecation warning for things that have changed.
If this is not realistic, then you should try to test all things of your app manually, and
grep the log files for the deprecation warnings.
Many deprecations in Rails 3.0 will lead to errors or wrong behaviour in Rails 3.1.
For updating the ruby and rails version to new is not take much more time but in your code you have to change all the quires and model scopes and whatever which does't work in new rails version of deprecated in new ruby and rails versions.And one more thing may be many gems which have support to ruby 1.8.7 will not support the new ruby version and same thing for the rail.
My suggestions is just, you first check the dependencies of your application with new versions and the get a decisions.I have knowledge about it because i have also upgrade a full application from ruby 1.8.7, rails 2.3.5 to ruby 1.9.3 and rails 3.2.13.
I have a legacy database(Progress OpenEdge) that i need to use for a myriad of reports. I have everything working with ruby 1.8.6 and rails 2.0 (odbc-adapter and odbc-rails).
Since 1.8.6 is not supported anymore and rails 2.0 is quite old i'd like to update. Is there a odbc-adapter supported on 3.2.3?
Any input is appreciated.
Thanks,
You have to put the following line in your gemfile: gem 'ruby-odbc' and then run bundle install.
i think this is what you were looking for :)
I am having the same problem except am using a legacy database called DBISAM from Elevate Software.
DBISAM does not support a lot of things. But I need to update things on the database and am not a wWindows ecosystem enthusiast.
I will look at ruby-odbc and report back to y'all
EDIT
I found using RDBI fixed my problem. gem rdbi
We are using jruby 1.6.x and we would like to switch to 1.9 mode because of UTF8 support. However, we don't want to upgrade rails from 2.3.8/2.3.11 to rails 3.
I tried to upgrade a Rails 2.3 application first to ruby 1.9.3. There were all kind of utf8-related problems. Some of them you can fix easily, by putting a utf8 header in the file, but some of the problems occur only in special conditions, for example when an error message is constructed from different parts somewhere deep in the rails stack, an one part was ascii, the other utf8.
When I investigated the problems I found other have also different kind of utf8 problems.
So it easier to go first to rails 3.0 and then to ruby 1.9
About half a year ago, when I started to learn Ruby and Rails, I first tried Ruby 1.9 but I soon gave up, because at that time nothing worked out of the box and almost every helping blog or tutorial was designed for Ruby 1.8.
What about now? (Dec 2009) Is it possible to get an existing Rails application running by a Ruby and Rails beginner without running into problems which can only be fixed by an absolute Ruby and Rails professional?
Unfortunately I dind't have good experiences with Ruby 1.9 and Rails.
You can read more here: Has anyone successfully deployed a Rails project with Ruby 1.9.1?
My opinion is that migrating an existing Rails app from Ruby 1.8.x to Ruby 1.9.1 is not as easy as you would think, event with an excellent test suite.
I'm also quite sure that most of the problems arise from trying to convert an existing application because you are working with an established code base.
Starting with a new Rails app with Ruby 1.9 should probably easier because you can trace a problem as soon as you write a single line of code so you can easily isolate which component is not compatible.
When migrating an existing app I had hard time trying to figure out which stack level was actually not compatible with Ruby 1.9. And there are more than one incompatible libraries at the same time I can't tell you how it's difficult to understand which one should be fixed first and which one originated the final error.
In 99.9% of the cases yes, there were rare cases where u might find problems but they should be solved with the new release.
As for the external gems and plugins, most of them now are fully compatible with ruby 1.9, however sepcial cases might exist but I'm not aware of any right now.