diff --git a/lib/cybele/app_builder.rb b/lib/cybele/app_builder.rb index 9cc021f..e079cbd 100644 --- a/lib/cybele/app_builder.rb +++ b/lib/cybele/app_builder.rb @@ -106,8 +106,15 @@ def configure_smtp config = <<-RUBY config.action_mailer.delivery_method = :smtp -config.action_mailer.raise_delivery_errors = false - config.action_mailer.smtp_settings = Settings.smtp.mandrill + config.action_mailer.raise_delivery_errors = false + config.action_mailer.smtp_settings = { + address: Settings.smtp.mandrill.address, + port: Settings.smtp.mandrill.port, + enable_starttls_auto: Settings.smtp.mandrill.enable_starttls_auto, + user_name: Settings.smtp.mandrill.user_name, + password: Settings.smtp.mandrill.password, + authentication: Settings.smtp.mandrill.authentication + } RUBY configure_environment 'production', config @@ -134,14 +141,14 @@ def setup_staging_environment config = <<-YML email: - noreply: noreply@appname.org + noreply: no-reply@#{app_name}.com YML prepend_file 'config/settings.yml', config end def configure_action_mailer - action_mailer_host 'development', "#{app_name}.dev" - action_mailer_host 'test', "#{app_name}.com" + action_mailer_host 'development', "localhost:3000" + action_mailer_host 'staging', "staging.#{app_name}.com" action_mailer_host 'production', "#{app_name}.com" end @@ -191,12 +198,12 @@ def generate_exception_notification def add_exception_notification_to_environments config = <<-CODE - config.middleware.use ExceptionNotification::Rack, - :email => { - :email_prefix => "[Whatever] ", - :sender_address => %{"notifier" }, - :exception_recipients => %w{exceptions@example.com} - } +config.middleware.use ExceptionNotification::Rack, + :email => { + :email_prefix => "[#{app_name}]", + :sender_address => %{"Notifier" }, + :exception_recipients => %w{your_email@address.com} + } CODE configure_environment('production', config) @@ -453,10 +460,7 @@ def create_sanitizer_initializer(model_name) def devise_parameter_sanitizer(model_name) inject_into_file 'app/controllers/application_controller.rb', :after => 'protect_from_forgery with: :exception' do <<-CODE - - protected - def devise_parameter_sanitizer if resource_class == #{model_name.classify} #{model_name.classify}::ParameterSanitizer.new(#{model_name.classify}, :#{model_name.parameterize}, params) @@ -496,7 +500,6 @@ def add_set_user_time_zone_method_to_application_controller def set_user_time_zone Time.zone = current_user.time_zone if user_signed_in? && current_user.time_zone.present? end - CODE end inject_into_file 'app/controllers/application_controller.rb', :after => 'class ApplicationController < ActionController::Base' do <<-CODE diff --git a/templates/app/controllers/hq/admin_profiles_controller.rb b/templates/app/controllers/hq/admin_profiles_controller.rb index 40a0a02..8d01eeb 100644 --- a/templates/app/controllers/hq/admin_profiles_controller.rb +++ b/templates/app/controllers/hq/admin_profiles_controller.rb @@ -3,7 +3,7 @@ class Hq::AdminProfilesController < Hq::ApplicationController before_action :check_profile, only: [:new, :create] before_action :profile_controller, except: [:new, :create] - before_action :set_admin_profile, only: [:show, :edit, :update, :destroy] + before_action :set_admin_profile, only: [:show, :edit, :update] add_breadcrumb I18n.t('activerecord.models.admin_profiles'), :hq_admin_profile_path def show diff --git a/templates/app/controllers/user_profiles_controller.rb b/templates/app/controllers/user_profiles_controller.rb index 6dce5c9..4b75cce 100644 --- a/templates/app/controllers/user_profiles_controller.rb +++ b/templates/app/controllers/user_profiles_controller.rb @@ -3,7 +3,7 @@ class UserProfilesController < ApplicationController before_action :authenticate_user! before_action :check_profile, only: [:new, :create] before_action :profile_controller, except: [:new, :create] - before_action :set_user_profile, only: [:show, :edit, :update, :destroy] + before_action :set_user_profile, only: [:show, :edit, :update] add_breadcrumb I18n.t('activerecord.models.user_profiles'), :user_profile_path def show @@ -45,7 +45,7 @@ def check_profile redirect_to user_profile_path end end - + def set_user_profile @user_profile = current_user.user_profile end