diff --git a/app/controllers/asks_controller.rb b/app/controllers/asks_controller.rb index 18b38da..90c9863 100644 --- a/app/controllers/asks_controller.rb +++ b/app/controllers/asks_controller.rb @@ -1,4 +1,4 @@ -class AsksController < ActionController::Base +class AsksController < ApplicationController helper Admin::AsksHelper include Admin::AsksHelper include ActionView::Helpers::FormHelper @@ -75,8 +75,7 @@ class AsksController < ActionController::Base page.select_option_items.each do |select_option_item| if !(@show_option_items.nil?) && select_option_item.field_name == @show_option_items.keys.first.to_s value = YAML.load(select_option_item.value) - locale = I18n.default_locale - I18n.with_locale(locale) do + I18n.with_locale(:en) do if value[locale] == t('ask.widget.index') @layout_type = 'index' elsif value[locale] == t('ask.is_published') @@ -219,11 +218,11 @@ class AsksController < ActionController::Base @group_mail = email_er.email_address @mail_sentdate = DateTime.now - site = Site.first - mail_from = site['title'][site['default_locale']] + site = current_site rescue Site.first + mail_from = site.title_translations[site.default_locale] email_er.email.update_attributes( - :mail_lang=> site['default_locale'], + :mail_lang=> site.default_locale, :create_user=>(current_user rescue nil), :mail_sentdate=>@mail_sentdate, :module_app=>@module_app, @@ -393,7 +392,7 @@ class AsksController < ActionController::Base switch_form = '' default_idx = 0 if categories.count != 0 - default_idx = ask_settings[1..-1].map{|a| a.category_id.to_s}.index(categories[0].id.to_s) + default_idx = ask_settings[1..-1].to_a.map{|a| a.category_id.to_s}.index(categories[0].id.to_s) default_idx = default_idx.nil? ? 0 : default_idx + 1 end switch_form = script_text + ask_settings.collect.with_index do |ask_setting,i|