diff --git a/app/controllers/channels_controller.rb b/app/controllers/channels_controller.rb index 97a60cd..7e87ac5 100644 --- a/app/controllers/channels_controller.rb +++ b/app/controllers/channels_controller.rb @@ -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? diff --git a/app/models/admin_user.rb b/app/models/admin_user.rb index a6b709d..6a0d272 100644 --- a/app/models/admin_user.rb +++ b/app/models/admin_user.rb @@ -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 diff --git a/app/models/channel.rb b/app/models/channel.rb index c191d6f..ef568bb 100644 --- a/app/models/channel.rb +++ b/app/models/channel.rb @@ -45,6 +45,7 @@ # video_type :string(255) # clearing :boolean default(FALSE), not null # ranking :integer +# user_agent :string(255) # class Channel < ActiveRecord::Base diff --git a/app/models/user.rb b/app/models/user.rb index 770ad65..11bd8f8 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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 ####### diff --git a/db/migrate/20140410174033_add_user_agent_to_channels.rb b/db/migrate/20140410174033_add_user_agent_to_channels.rb new file mode 100644 index 0000000..1e11bfc --- /dev/null +++ b/db/migrate/20140410174033_add_user_agent_to_channels.rb @@ -0,0 +1,6 @@ +class AddUserAgentToChannels < ActiveRecord::Migration + def change + add_column :channels, :user_agent, :string + end +end + diff --git a/db/schema.rb b/db/schema.rb index c1ac184..704ff18 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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 diff --git a/spec/models/channel_spec.rb b/spec/models/channel_spec.rb index a8a1507..a8eae89 100644 --- a/spec/models/channel_spec.rb +++ b/spec/models/channel_spec.rb @@ -46,6 +46,7 @@ # video_type :string(255) # clearing :boolean default(FALSE), not null # ranking :integer +# user_agent :string(255) # require 'spec_helper' diff --git a/test/fixtures/admin_users.yml b/test/fixtures/admin_users.yml index 937a0c0..63cc1c4 100644 --- a/test/fixtures/admin_users.yml +++ b/test/fixtures/admin_users.yml @@ -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