开发者

rails 3 project, how to use tinyurl?

Is anyone aware of how to get inyurls in a ruby 192/rails 3 app?

I thought this would be simple... installed the gem 'shorturl' also added it to my Gemfile, did bundle install, and it all looked fine except when I run rails console it immediately throws an error so it's apparently not compatible with ruby 192/rails3.

c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/runtime.rb:64:in `require': c:/Ruby192/lib/ruby/gems/1.9.1/gems/shorturl-0.8.8/lib/short
url.rb:42: syntax error, unexpected ':', expecting keyword_then or ',' or ';' or '\n' (SyntaxError)
                 when :post: http.post(@action, "#{@field...

I considered using Bitly, the gem installed fine, but bit开发者_Python百科ly makes PUBLIC all of the urls you shorten... really not a good idea since we're providing urls to private links.


The when x: syntax is not compatible with Ruby 1.9 (you have to use when x then). Contact the gem author or fix it yourself by forking the repo. Alternatively you can use Ruby 1.8.7 for this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜