rabl icon indicating copy to clipboard operation
rabl copied to clipboard

Is v0.13.x going to be compatible with Ruby 2.0.0?

Open 5thWall opened this issue 7 years ago • 12 comments

I have a new Rails project using rabl v0.13.0 and I'm getting this error.

lib/rabl/digestor.rb:6: syntax error, unexpected ',' (SyntaxError)
      def self.digest(name:, finder:, **options)

5thWall avatar Jul 28 '16 17:07 5thWall

@5thWall what is your ruby version?

krzysiek1507 avatar Jul 28 '16 17:07 krzysiek1507

2.0.0-p648 unfortunately. I didn't realize that was a method definition so error makes sense. I understand if you're dropping support for such an old version.

5thWall avatar Jul 28 '16 20:07 5thWall

@5thWall and what is your version of Rails?

krzysiek1507 avatar Jul 28 '16 21:07 krzysiek1507

The problem is described here: https://robots.thoughtbot.com/ruby-2-keyword-arguments#required-keyword-arguments It's Ruby 2.1

krzysiek1507 avatar Jul 28 '16 21:07 krzysiek1507

So is Ruby 2.0.0 not being supported? The Travis config lists all the way down to 1.9.3.

5thWall avatar Jul 28 '16 21:07 5thWall

@5thWall But not with Rails 5. Rails 5 requires Ruby >= 2.2.2.

krzysiek1507 avatar Jul 28 '16 21:07 krzysiek1507

Can the gemspec be updated to indicate the minimum Ruby version supported for subsequent releases? I got caught out on this and first checked the compatibility info reported by Rubygems.

seandmccarthy avatar Sep 02 '16 05:09 seandmccarthy

@krzysiek1507 Does RABL work on Ruby 2.5 and Rails 5.1?

swordfish444 avatar Feb 21 '18 21:02 swordfish444

Bump on this.

Just upgrade Ruby to 2.5.1 and Rails to 5.2.1 and my views were unchanged but whenever I try to render a partial or extend another view it bombs.

cc: @nesquena @krzysiek1507

richessler avatar Oct 11 '18 00:10 richessler

The tests pass for ruby-2-5-1 so we're missing something in the tests. Can someone provide their template or a new rails app that reproduces the issue?

databyte avatar Oct 11 '18 01:10 databyte

@databyte what breaks my app is this

child :map_author, object_root: false  do
    extends('api/v2/maps/map_author')
  end

 child :map_audios, object_root: false  do
    extends('api/v2/maps/map_audios')
  end

and in the template is

#/views/api/v2/_author.rabl
object @map_author
cache root_object
attributes :id, :name, :description, :photo_file, :photo_s3
node(:photo_url) { |a| "#{ENV['S3_BUCKET_URL']}/#{URI.encode(a.photo_s3)}" unless a.photo_s3.nil? }

#/views/api/v2/_map_audios.rabl
collection @map_audios
cache root_object
attributes :id, :map_id, :name, :description, :file, :file_s3, :created_at, :updated_at
node(:url) { |a| "#{ENV['S3_BUCKET_URL']}/#{URI.encode(a.file_s3)}" unless a.file_s3.nil? }

richessler avatar Oct 11 '18 01:10 richessler

That's a big file and I don't have all the variables and database fields that go with it. To help out, if you were to comment out each line one by one - can you find the breaking line? Think git bisect but for rabl template file troubleshooting.

databyte avatar Oct 11 '18 02:10 databyte