add user_agent to channels

This commit is contained in:
Lee Lawlor 2014-04-10 14:03:08 -04:00
parent a727752c94
commit 6ff22048b4
8 changed files with 51 additions and 1 deletions

View File

@ -265,6 +265,8 @@ class ChannelsController < ApplicationController
entry_id = channel.next_entry_id
channel.last_entry_id = entry_id
feed.entry_id = entry_id
# set user agent
channel.user_agent = get_header_value('USER_AGENT')
# try to get created_at datetime if appropriate
if params[:created_at].present?

View File

@ -1,3 +1,22 @@
# == Schema Information
#
# Table name: admin_users
#
# id :integer not null, primary key
# email :string(255) default(""), not null
# encrypted_password :string(255) default(""), not null
# reset_password_token :string(255)
# reset_password_sent_at :datetime
# remember_created_at :datetime
# sign_in_count :integer default(0), not null
# current_sign_in_at :datetime
# last_sign_in_at :datetime
# current_sign_in_ip :string(255)
# last_sign_in_ip :string(255)
# created_at :datetime
# updated_at :datetime
#
class AdminUser < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable

View File

@ -45,6 +45,7 @@
# video_type :string(255)
# clearing :boolean default(FALSE), not null
# ranking :integer
# user_agent :string(255)
#
class Channel < ActiveRecord::Base

View File

@ -23,6 +23,7 @@
# remember_created_at :datetime
# sign_in_count :integer default(0), not null
# authentication_token :string(255)
# terms_agreed_at :datetime
#
####### NOTE #######

View File

@ -0,0 +1,6 @@
class AddUserAgentToChannels < ActiveRecord::Migration
def change
add_column :channels, :user_agent, :string
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20140320200307) do
ActiveRecord::Schema.define(version: 20140410174033) do
create_table "active_admin_comments", force: true do |t|
t.string "namespace"
@ -102,6 +102,7 @@ ActiveRecord::Schema.define(version: 20140320200307) do
t.string "video_type"
t.boolean "clearing", default: false, null: false
t.integer "ranking"
t.string "user_agent"
end
add_index "channels", ["public_flag", "last_entry_id", "updated_at"], name: "channels_public_viewable", using: :btree

View File

@ -46,6 +46,7 @@
# video_type :string(255)
# clearing :boolean default(FALSE), not null
# ranking :integer
# user_agent :string(255)
#
require 'spec_helper'

View File

@ -1,3 +1,22 @@
# == Schema Information
#
# Table name: admin_users
#
# id :integer not null, primary key
# email :string(255) default(""), not null
# encrypted_password :string(255) default(""), not null
# reset_password_token :string(255)
# reset_password_sent_at :datetime
# remember_created_at :datetime
# sign_in_count :integer default(0), not null
# current_sign_in_at :datetime
# last_sign_in_at :datetime
# current_sign_in_ip :string(255)
# last_sign_in_ip :string(255)
# created_at :datetime
# updated_at :datetime
#
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
# This model initially had no columns defined. If you add columns to the