How do I set the proper Ruby version for use with my Rails 5 project in Aptana 3?

216 Views Asked by At

I'm usingn Aptana Studio 3 on Mac High Sierra. I have imported my Rails 5 project and set "Rails" as my project natures in the "Properties" section of my project. However when editing some Ruby files, Aptana is incorrectly reporting syntax errors on the left side of the editor. For example, this line

creds = PasswordService.find_user(params[:login])&.object

is flagged with this error

syntax error, unexpected tDOT

even though this doesn't raise any errors when I run my project. I'm wondering if Aptana is not picking up the correct version of Ruby associated with my project but I'm not sure how to check/set that.

2

There are 2 best solutions below

1
Paulo Fidalgo On

I don't use Aptana, but maybe you want to set your Ruby version too because the safe navigation & is a Ruby feature. In the project directory run ruby -v in the console and check the ruby version, it must be higher than 2.3.

If you use a ruby version manager (rbenv or rvm) make sure you configure the right Ruby version for the project.

1
jeremy04 On

Is studio3-ruby the plugin you're using?

If so, I found this open issue that seems related to Ruby 2.0 support: https://github.com/aptana/studio3-ruby/issues/8