vinistock/sail

Unable to use Sail v1.5.0

rohandaxini opened this issue · 4 comments

Hello @vinistock

After installing the latest version of sail gem 1.5.0, I am facing lot of problems now on my Rails 4 application.

  1. From rails console I am unable to create any setting. Following is the error 👇
2.2.2 :001 > Sail::Setting.create(name: :my_setting, cast_type: :integer, description: 'A very important setting', value: '15')
SyntaxError: /Users/rohan/.rvm/gems/ruby-2.2.2/gems/sail-1.5.0/app/models/sail/setting.rb:62: syntax error, unexpected '.'
...ere(name: throttled_by).first&.throttle?
...                               ^
	from /Users/rohan/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:457:in `load'
	from /Users/rohan/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:457:in `block in load_file'
	from /Users/rohan/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:647:in `new_constants_in'
	from /Users/rohan/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:456:in `load_file'
	from /Users/rohan/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:354:in `require_or_load'
	from /Users/rohan/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:494:in `load_missing_constant'
	from /Users/rohan/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:184:in `const_missing'
	from (irb):1
	from /Users/rohan/.rvm/gems/ruby-2.2.2/gems/railties-4.2.4/lib/rails/commands/console.rb:110:in `start'
	from /Users/rohan/.rvm/gems/ruby-2.2.2/gems/railties-4.2.4/lib/rails/commands/console.rb:9:in `start'
	from /Users/rohan/.rvm/gems/ruby-2.2.2/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:68:in `console'
	from /Users/rohan/.rvm/gems/ruby-2.2.2/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
	from /Users/rohan/.rvm/gems/ruby-2.2.2/gems/railties-4.2.4/lib/rails/commands.rb:17:in `<top (required)>'
	from script/rails:6:in `require'
	from script/rails:6:in `<main>'
  1. I recreated migrations and installed sail from scratch on my application for v1.5.0 and now when I navigate to http://localhost:3000/sail then I face following errors 👇

screen shot 2018-12-09 at 6 27 37 pm

Can you guide me if I am missing any step?

@rohandaxini it's probably failing because of the safe navigator operator (&.) which was introduced in Ruby 2.3.0. You're using Ruby 2.2.2, so that's likely the reason. I will add support for Ruby 2 and add it to the travis build to make sure we're covered.

@rohandaxini I just found out that the latest version of Capybara dependes on xpath 3.2.0, which requires a Ruby version >= 2.3.0.

I believe my PR will address your issue, because of the safe navigator operator, however, I would recommend upgrading your environment (trying to use the latest Ruby and the latest Rail versions). Newer version contain new features, better performance and security fixes.

I will push out a small release for 1.5.1 and please let me know if it works for you.

@vinistock Yeah my other app uses Rails 5 and latest Ruby. I am on Ruby 2.4.3 for a couple of other apps as well. But for this app knowboddy, I thought we want to support the older version with Sail so I was trying it. I will try with latest Ruby on Knowbuddy and check Sail. Will keep you posted.

@rohandaxini I believe supporting Ruby >= 2.3.0 and Rails >= 4 should be enough. Many gems already require Ruby >= 2.3.0 and Rails 3 is a little out dated as well.