`@@{' is not allowed as a class variable name (SyntaxError) while using s3 gem + rails 4.1.5
Asked Answered
C

2

7

I know this type of question is already asked.

I use s3 gem to upload my files in s3 bucket. But after s3 gem installation, when I start rails server it shows this error:

    /var/lib/gems/1.9.1/gems/aws-s3-0.6.3/lib/aws/s3/extensions.rb:223:in `class_eval': /var/lib/gems/1.9.1/gems/aws-s3-0.6.3/lib/aws/s3/extensions.rb:223: `@@{' is not allowed as a class variable name (SyntaxError)
/var/lib/gems/1.9.1/gems/aws-s3-0.6.3/lib/aws/s3/extensions.rb:223: syntax error, unexpected $end
        unless defined? @@{:instance_writer=>true}
                          ^
    from /var/lib/gems/1.9.1/gems/aws-s3-0.6.3/lib/aws/s3/extensions.rb:223:in `block in cattr_reader'
    from /var/lib/gems/1.9.1/gems/aws-s3-0.6.3/lib/aws/s3/extensions.rb:222:in `each'
    from /var/lib/gems/1.9.1/gems/aws-s3-0.6.3/lib/aws/s3/extensions.rb:222:in `cattr_reader'
    from /var/lib/gems/1.9.1/gems/aws-s3-0.6.3/lib/aws/s3/extensions.rb:258:in `cattr_accessor'
    from /var/lib/gems/1.9.1/gems/activesupport-4.1.5/lib/active_support/cache.rb:155:in `<class:Store>'
    from /var/lib/gems/1.9.1/gems/activesupport-4.1.5/lib/active_support/cache.rb:154:in `<module:Cache>'
    from /var/lib/gems/1.9.1/gems/activesupport-4.1.5/lib/active_support/cache.rb:14:in `<module:ActiveSupport>'
    from /var/lib/gems/1.9.1/gems/activesupport-4.1.5/lib/active_support/cache.rb:12:in `<top (required)>'
    from /var/lib/gems/1.9.1/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:247:in `require'
    from /var/lib/gems/1.9.1/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:247:in `block in require'
    from /var/lib/gems/1.9.1/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:232:in `load_dependency'
    from /var/lib/gems/1.9.1/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:247:in `require'
    from /var/lib/gems/1.9.1/gems/jbuilder-2.2.5/lib/jbuilder/jbuilder_template.rb:3:in `<top (required)>'
    from /var/lib/gems/1.9.1/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:247:in `require'
    from /var/lib/gems/1.9.1/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:247:in `block in require'
    from /var/lib/gems/1.9.1/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:232:in `load_dependency'
    from /var/lib/gems/1.9.1/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:247:in `require'
    from /var/lib/gems/1.9.1/gems/jbuilder-2.2.5/lib/jbuilder/railtie.rb:2:in `<top (required)>'
    from /var/lib/gems/1.9.1/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:247:in `require'
    from /var/lib/gems/1.9.1/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:247:in `block in require'
    from /var/lib/gems/1.9.1/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:232:in `load_dependency'
    from /var/lib/gems/1.9.1/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:247:in `require'
    from /var/lib/gems/1.9.1/gems/jbuilder-2.2.5/lib/jbuilder.rb:317:in `<top (required)>'
    from /var/lib/gems/1.9.1/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in `require'
    from /var/lib/gems/1.9.1/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
    from /var/lib/gems/1.9.1/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in `each'
    from /var/lib/gems/1.9.1/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in `block in require'
    from /var/lib/gems/1.9.1/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in `each'
    from /var/lib/gems/1.9.1/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in `require'
    from /var/lib/gems/1.9.1/gems/bundler-1.6.2/lib/bundler.rb:132:in `require'
    from /home/rick/rick/Projects/practice/sharebox/config/application.rb:7:in `<top (required)>'
    from /var/lib/gems/1.9.1/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:79:in `require'
    from /var/lib/gems/1.9.1/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:79:in `block in server'
    from /var/lib/gems/1.9.1/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:76:in `tap'
    from /var/lib/gems/1.9.1/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:76:in `server'
    from /var/lib/gems/1.9.1/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
    from /var/lib/gems/1.9.1/gems/railties-4.1.5/lib/rails/commands.rb:17:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

Does anyone know, how to solve this error? Should I try another gem?

Cuffs answered 28/11, 2014 at 11:53 Comment(6)
Could you provide full trace error?Nematic
i have updated my question with full error @rockskullCuffs
Have you read this answer: https://mcmap.net/q/1095857/-aws-s3-gem-unless-defined-instance_writer-gt-true ?Nematic
@rockskull I have got the solution. What i have did i installed aws-sdk gem.Cuffs
@rockskull yup i have already read that.Cuffs
Glad to hear that. So, update your question or post the answer so people with the same problem can see what was the solution. ;)Nematic
L
4

Yeah i just ran into this issue and resolved. It is because AWS updated their gem to 2.0. If you update the gem to 2.0 different configuration is required according to this article they posted.

If you want to using the version you had before, just change the Gemfile like below:

Gemfile

gem 'aws-sdk', '< 2.0'

Lowestoft answered 6/2, 2015 at 7:46 Comment(0)
R
1

We had the same issue this morning. We already had this aws-sdk gem installed but it was updated to version 2 yesterday. It seems that version 2 doesn't fix this anymore so I advice to use last version 1 : 1.61.0

Rhizocarpous answered 6/2, 2015 at 1:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.