Subscribed unsubscribe Subscribe Subscribe

RailsでTreasure Dataにデータを送る

heroku rails treasure data

Gemfile

gem 'td'

config/treasure_data.yml

#
# This file configures the Treasure Data, Hadoop-based cloud data warehouse.
# For more information, visit http://www.treasure-data.com/.
#
production:
  # Treasure Data API Key
  # TREASURE_DATA_API_KEY is automatically defined when you add treasure-data
  # heroku addon.
  apikey: "<%= ENV['TREASURE_DATA_API_KEY'] %>"

  # Database name
  # Set this to be the name of your database as you'd like it show up in
  # `heroku td dbs` command.
  database: production

  # Debug Mode
  # Less verbose for production environment.
  debug_mode: false

# For development environment, logging to Treasure Data is disabled by default.
development:

# For test environment, logging to Treasure Data is disabled by default.
test:

あとは、コントローラ等で以下のように呼び出して利用する。

TD.event.post('login', uid: @resource.id)