Ruby China
  • 社区
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • 注册
  • 登录
nuc093
@nuc093
会员
第 19568 位会员 / 2015-06-25

[email protected]
0 篇帖子 / 9 条回帖
0 关注者
13 正在关注
0 收藏
未设置 GitHub 信息。
  • 概况
  • 话题
  • 回帖
  • 收藏
  • 正在关注
  • 关注者
  • 使用 Rails 构建 API 实践 at 2015年06月30日

    @ken @kayakjiang 84#问题解决了。代码已push。

    给数据库中已存在的测试用户增加密码和 authentication token 这步出问题了

    ➜  build-api-rails git:(master) bundle exe rails c
    Loading development environment (Rails 4.2.1)
    2.0.0-p481 :001 > User.all.each {|user|
    2.0.0-p481 :002 >       user.password = '123123'
    2.0.0-p481 :003?>     user.reset_auth_token!
    2.0.0-p481 :004?>   }
    SyntaxError: /Users/qk/mygithub/build-api-rails/app/models/user.rb:7: syntax error, unexpected keyword_self, expecting '|'
                self.authentication_token = SecureRandom.base64(64)
                    ^
    /Users/qk/mygithub/build-api-rails/app/models/user.rb:9: syntax error, unexpected keyword_end
    /Users/qk/mygithub/build-api-rails/app/models/user.rb:16: syntax error, unexpected end-of-input, expecting keyword_end
        from /Users/qk/.rvm/gems/ruby-2.0.0-p481/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:457:in `load'
        from /Users/qk/.rvm/gems/ruby-2.0.0-p481/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:457:in `block in load_file'
        from /Users/qk/.rvm/gems/ruby-2.0.0-p481/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:647:in `new_constants_in'
        from /Users/qk/.rvm/gems/ruby-2.0.0-p481/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:456:in `load_file'
        from /Users/qk/.rvm/gems/ruby-2.0.0-p481/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:354:in `require_or_load'
        from /Users/qk/.rvm/gems/ruby-2.0.0-p481/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:494:in `load_missing_constant'
        from /Users/qk/.rvm/gems/ruby-2.0.0-p481/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:184:in `const_missing'
        from (irb):1
        from /Users/qk/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.2.1/lib/rails/commands/console.rb:110:in `start'
        from /Users/qk/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.2.1/lib/rails/commands/console.rb:9:in `start'
        from /Users/qk/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:68:in `console'
        from /Users/qk/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
        from /Users/qk/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.2.1/lib/rails/commands.rb:17:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'
    
    
  • [北京][2015年7月4日] 技术分享 at 2015年06月30日

    不知道这个路线地址对不对

    http://map.baidu.com/?newmap=1&s=bse%26c%3D131%26wd%3D%E5%8C%97%E4%BA%AC%E5%8D%97%26isSingle%3Dtrue%26t%3D1%26name%3DWondermilk%E5%B9%BF%E6%B8%A0%E8%B7%AF%E5%BA%97)%26uid%3Dbe6d47b3d46c2d11b45f1ee4%26ptx%3D12970722.00%26pty%3D4823850.00%26poiType%3D0%26sn%3D1%24%24be6d47b3d46c2d11b45f1ee4%24%2412970722.00%2C4823850.00%24%24Wondermilk%E5%B9%BF%E6%B8%A0%E8%B7%AF%E5%BA%97)%24%24%24%24%24%24(

  • [北京][2015年7月4日] 技术分享 at 2015年06月30日

    一定要支持一下的

  • 使用 Rails 构建 API 实践 at 2015年06月30日

    @kayakjiang 我本机的代码

    https://github.com/jnuc093/build-an-api-rails-demo

  • 使用 Rails 构建 API 实践 at 2015年06月29日
    ➜  build-an-api-rails-demo  rails --version
    Rails 4.2.1
    
    
    • 执行 curl -i http://localhost:3000/api/v1/users/1 时报以下错误
    Started GET "/api/v1/users/1" for ::1 at 2015-06-29 21:10:00 +0800
    
    ArgumentError (Invalid request forgery protection method, use :null_session, :exception, or :reset_session):
      app/controllers/api/v1/base_controller.rb:3:in `<class:BaseController>'
      app/controllers/api/v1/base_controller.rb:1:in `<top (required)>'
      app/controllers/api/v1/users_controller.rb:1:in `<top (required)>'
    
    
  • 大家的有什么打算写的小项目吗? at 2015年06月29日

    @cqcn1991 +微信应用

  • 大家的有什么打算写的小项目吗? at 2015年06月29日

    @cqcn1991 可以写个这个 http://codemy.net/posts/integrating-framework7-into-rails

  • 大家的有什么打算写的小项目吗? at 2015年06月29日

    @cqcn1991 整点实在的微信接入什么的吧。

  • 是不是像石家庄这种的小城市都没有公司用 ruby 呢 at 2015年06月28日

    #1 石家庄有个 写 java mybatis 工具包的。

关于 / RubyConf / Ruby 镜像 / RubyGems 镜像 / 活跃会员 / 组织 / API / 贡献者
由众多爱好者共同维护的 Ruby 中文社区,本站使用 Homeland 构建,并采用 Docker 部署。
服务器由 赞助 CDN 由 赞助
iOS 客户端 / Android 客户端 简体中文 / English