From 2fc4e2db61ffdcd54df9eada9fffea3754c80120 Mon Sep 17 00:00:00 2001 From: "konstantin.grabar" Date: Thu, 19 Apr 2012 14:50:43 +0400 Subject: [PATCH] [refs #396] Fix token migration. Fix atom link tag title --- app/views/layouts/application.html.haml | 2 +- config/locales/en.yml | 1 + config/locales/ru.yml | 1 + ...20418100619_add_token_authenticatable_to_users.rb | 12 +++++++----- db/schema.rb | 1 + 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 2952fa04f..a6024770b 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -9,7 +9,7 @@ = javascript_include_tag "application" = csrf_meta_tag = display_meta_tags :site => APP_CONFIG['project_name'], :reverse => true, :separator => '-' - = auto_discovery_link_tag :atom, root_path + '.atom', :title => "Rosalab News Feed" + = auto_discovery_link_tag :atom, root_path + '.atom', :title => t("layout.atom_link_tag_title", :nickname => current_user.name, :app_name => APP_CONFIG['project_name']) %body .wrap{:class => content_for?(:sidebar) ? 'columns' : ''} diff --git a/config/locales/en.yml b/config/locales/en.yml index b78182bff..2ff1cac83 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -44,6 +44,7 @@ en: back: Back processing: working ... invalid_content_type: incorrect type + atom_link_tag_title: Private feed for %{nickname} | %{app_name} settings: label: Settings diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 670dcec8f..f389e4f00 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -44,6 +44,7 @@ ru: back: Назад processing: Обрабатывается... invalid_content_type: имеет неверный тип + atom_link_tag_title: Приватная лента для %{nickname} | %{app_name} settings: label: 'Настройки' diff --git a/db/migrate/20120418100619_add_token_authenticatable_to_users.rb b/db/migrate/20120418100619_add_token_authenticatable_to_users.rb index b0a04f02d..7c0b7511a 100644 --- a/db/migrate/20120418100619_add_token_authenticatable_to_users.rb +++ b/db/migrate/20120418100619_add_token_authenticatable_to_users.rb @@ -1,13 +1,15 @@ class AddTokenAuthenticatableToUsers < ActiveRecord::Migration - def change - change_table :users do |t| - t.token_authenticatable - end - + def self.up + add_column :users, :authentication_token, :string add_index :users, :authentication_token User.all.each do |user| user.ensure_authentication_token! end end + + def self.down + remove_column :users, :authentication_token + remove_index :users, :authentication_token + end end diff --git a/db/schema.rb b/db/schema.rb index 02a93e9c1..0b20e0d3a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -350,6 +350,7 @@ ActiveRecord::Schema.define(:version => 20120418100619) do t.string "authentication_token" end + add_index "users", ["authentication_token"], :name => "index_users_on_authentication_token" add_index "users", ["confirmation_token"], :name => "index_users_on_confirmation_token", :unique => true add_index "users", ["email"], :name => "index_users_on_email", :unique => true add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true