From e6f4f3689c6b6a5afcf13ca417b0cff50febfa77 Mon Sep 17 00:00:00 2001 From: cake Date: Wed, 15 Sep 2010 23:24:48 +0900 Subject: [PATCH] =?utf8?q?basic=E8=AA=8D=E8=A8=BC=E3=80=81=E3=83=A1?= =?utf8?q?=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8=E3=81=AE=E6=97=A5=E6=9C=AC?= =?utf8?q?=E8=AA=9E=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 7 +++++++ config/config.yml | 7 +++++++ config/environment.rb | 3 ++- config/initializers/app_config.rb | 4 ++++ config/locales/translation_ja.yml | 18 +++++++++--------- 5 files changed, 29 insertions(+), 10 deletions(-) create mode 100644 config/config.yml create mode 100644 config/initializers/app_config.rb diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 6635a3f..f4ce653 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -4,7 +4,14 @@ class ApplicationController < ActionController::Base helper :all # include all helpers, all the time protect_from_forgery # See ActionController::RequestForgeryProtection for details + before_filter :authenticate # Scrub sensitive parameters from your log # filter_parameter_logging :password + + def authenticate + authenticate_or_request_with_http_basic do |user_name, password| + user_name == AppConfig.user_name && password == AppConfig.password + end + end end diff --git a/config/config.yml b/config/config.yml new file mode 100644 index 0000000..60ff807 --- /dev/null +++ b/config/config.yml @@ -0,0 +1,7 @@ +common: &common + foo: "bar" + +development: + <<: *common + user_name: 'user' + password: 'pass' diff --git a/config/environment.rb b/config/environment.rb index 39545f1..93944c0 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,7 +1,7 @@ # Be sure to restart your server when you modify this file # Specifies gem version of Rails to use when vendor/rails is not present -RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION +RAILS_GEM_VERSION = '2.3.8' unless defined? RAILS_GEM_VERSION # Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), 'boot') @@ -38,4 +38,5 @@ Rails::Initializer.run do |config| # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')] # config.i18n.default_locale = :de + config.i18n.default_locale = :ja end diff --git a/config/initializers/app_config.rb b/config/initializers/app_config.rb new file mode 100644 index 0000000..75727de --- /dev/null +++ b/config/initializers/app_config.rb @@ -0,0 +1,4 @@ +require 'ostruct' +require 'yaml' +config = YAML.load_file("#{RAILS_ROOT}/config/config.yml") || {} +::AppConfig = OpenStruct.new(config[RAILS_ENV]) diff --git a/config/locales/translation_ja.yml b/config/locales/translation_ja.yml index 3c82bb4..71f5bcd 100644 --- a/config/locales/translation_ja.yml +++ b/config/locales/translation_ja.yml @@ -1,24 +1,24 @@ ja: activerecord: models: - song: "ソング" #g + song: "楽曲" #g attributes: song: code: "コード" #g - title: "タイトル" #g - words: "言葉" #g + title: "題名" #g + words: "歌詞" #g words_for_search: "検索ワード" #g - copyright: "著作権" #g + copyright: "出典" #g font_size: "フォントサイズ" #g - deleted_at: "で削除" #g + deleted_at: "削除日時" #g selectable_attrs: Song: font_size: xsmall: "Xsmall" #g - small: "スモール" #g - middle: "中間" #g - large: "大" #g - xlarge: "エクストララージ" #g + small: "Small" #g + middle: "Middle" #g + large: "Large" #g + xlarge: "Xlarge" #g -- 2.11.0