I'm trying to get a rails website up and running from github, and I'm encountering these errors:
WARNING: 'task :t, arg, :needs => [deps]' is deprecated. Please use 'task :t, [args] => [deps]' instead.
at /Library/Ruby/Gems/1.8/gems/sunspot_rails-1.2.1/lib/sunspot/rails/tasks.rb:41 rake aborted! /Users/robertgrzesik/Documents/RubyOnRails/IndieOption/app/helpers/advertisements_helper.rb:15: odd number list for Hash
user_id: current_user.id,
^ /Users/robertgrzesik/Documents/RubyOnRails/IndieOption/app/helpers/advertisements_helper.rb:15: syntax error, unexpected ':', expecting '}'
user_id: current_user.id,
^ /Users/robertgrzesik/Documents/RubyOnRails/IndieOption/app/helpers/advertisements_helper.rb:16: syntax error, unexpected ':', expecting '='
page: request.url
^ /Users/robertgrzesik/Documents/RubyOnRails/IndieOption/app/helpers/advertisements_helper.rb:17: syntax error, unexpected '}', expecting kEND
})
^ /Users/robertgrzesik/Documents/RubyOnRails/IndieOption/app/helpers/advertisements_helper.rb:20: odd number list for Hash
page: request.url
^ /Users/robertgrzesik/Documents/RubyOnRails/IndieOption/app/helpers/advertisements_helper.rb:20: syntax error, unexpected ':', expecting '}'
page: request.url
^ /Users/robertgrzesik/Documents/RubyOnRails/IndieOption/app/helpers/advertisements_helper.rb:21: syntax error, unexpected '}', expecting kEND
})
^
for this code:
if ad
if current_user
ad.impressions.create({
user_id: current_user.id,
page: request.url
})
else
ad.impressions.create({
page: request.url
})
end
link_to external_redirect_advertisement_url(ad) do
image_tag ad.image.url(format)
end
else
nil
end
end
Any ideas?
You're trying to use 1.9 hash syntax (key: value
) with a 1.8 Ruby (:key => value
).
What version of Ruby are you running? The hashes look correct at first glance, but the foo: 'bar'
hash syntax is 1.9+ only. If you're using Ruby 1.8.x you'll need up upgrade.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With