简体   繁体   English

如何在Rails中的ruby中实现Badgeville

[英]How to implement badgeville in ruby on rails

Can anyone tell me how to implement badgeville in ruby on rails? 谁能告诉我如何在红宝石中实现badgeville

EDIT: how can I apply this on ruby on rails? 编辑:如何将其应用在轨道上的红宝石上?

https://github.com/badgeville/badgeville-ruby https://github.com/badgeville/badgeville-ruby

I'm not sure how this particular gem work, but normally it should work with following steps 我不确定这个特殊的宝石如何工作,但是通常它应该按照以下步骤工作

  1. create a file called 'badgeville.rb' inside app/config/initializers 在app / config / initializers中创建一个名为“ badgeville.rb”的文件
  2. add the following code to badgeville.rb 将以下代码添加到badgeville.rb

    BadgevilleBerlin::Config.conf( :host_name => " http://example.com ", :api_key => MY_API_KEY) BadgevilleBerlin :: Config.conf(:host_name =>“ http://example.com ”,:api_key => MY_API_KEY)

  3. restart 重新开始

  4. then you should be able to use the following commands inside your controllers/ models 那么您应该能够在控制器/模型中使用以下命令

    Ex: 例如:

    new_site = BadgevilleBerlin::Site.new( :name => "My Website", :url => "mydomain.com", :network_id => MY_NETWORK_ID ) success = new_site.save new_site = BadgevilleBerlin :: Site.new(:name =>“我的网站”,:url =>“ mydomain.com”,:network_id => MY_NETWORK_ID)成功= new_site.save

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM