From 36d95c816a75b0626959e443b8812f63bd67e723 Mon Sep 17 00:00:00 2001 From: crowesn Date: Fri, 27 Mar 2015 09:42:46 -0400 Subject: [PATCH] fix bugs for production environment --- app/controllers/marc_uploads_controller.rb | 8 ++++---- app/mailers/order_mailer.rb | 2 +- app/views/marc_downloads/index.html.erb | 2 +- app/views/marc_uploads/index.html.erb | 2 +- app/views/order_mailer/new_order.html.erb | 2 +- app/views/orders/_show_admin_actions.html.erb | 2 +- config/application.rb | 2 +- config/environments/development.rb | 1 - config/environments/production.rb | 1 + db/migrate/20140328162816_create_losts.rb | 2 +- .../20150122191758_create_dda_expenditures.rb | 2 +- db/schema.rb | 20 ++----------------- 12 files changed, 15 insertions(+), 31 deletions(-) diff --git a/app/controllers/marc_uploads_controller.rb b/app/controllers/marc_uploads_controller.rb index 48c1a81..f5d9c8c 100644 --- a/app/controllers/marc_uploads_controller.rb +++ b/app/controllers/marc_uploads_controller.rb @@ -1,15 +1,15 @@ class MarcUploadsController < ApplicationController before_filter :authenticate_user! def create - redirect_to '/marc_uploads' and flash[:notice] = 'Include file!' and return if params[:upload].nil? + redirect_to marc_uploads_path and flash[:notice] = 'Include file!' and return if params[:upload].nil? name = params[:upload][:file].original_filename - redirect_to '/marc_uploads' and flash[:notice] = 'Input only .xlsx format files!' and return if File.extname(name) != '.xlsx' + redirect_to marc_uploads_path and flash[:notice] = 'Input only .xlsx format files!' and return if File.extname(name) != '.xlsx' directory = "public/tmp/records" @path = File.join(directory, name) File.open(@path, "wb") { |f| f.write(params[:upload][:file].read) } s = Roo::Excelx.new(@path) - redirect_to '/marc_uploads' and flash[:notice] = 'Columns must be in order: Label, Catalog, Title, UPC, Format, Invoice, Price' and return if s.row(1) != ['Label', 'Catalog', 'Title', 'UPC', 'Format', 'Invoice', 'Price'] + redirect_to marc_uploads_path and flash[:notice] = 'Columns must be in order: Label, Catalog, Title, UPC, Format, Invoice, Price' and return if s.row(1) != ['Label', 'Catalog', 'Title', 'UPC', 'Format', 'Invoice', 'Price'] writer = MARC::Writer.new("#{directory}/#{name.gsub('xlsx', 'mrc')}") s.drop(1).each do |row| @@ -25,6 +25,6 @@ def create end writer.close() flash[:notice] = "Records Processed" - redirect_to "/marc_downloads" + redirect_to marc_downloads_path end end diff --git a/app/mailers/order_mailer.rb b/app/mailers/order_mailer.rb index 44c5455..ae5b6e0 100644 --- a/app/mailers/order_mailer.rb +++ b/app/mailers/order_mailer.rb @@ -1,5 +1,5 @@ class OrderMailer < ActionMailer::Base - default from: "NO-REPLY@larry.libraries.uc.edu" + default from: "NO-REPLY@lucy.libraries.uc.edu" def new_order(user, order) @user = user diff --git a/app/views/marc_downloads/index.html.erb b/app/views/marc_downloads/index.html.erb index 4d52e3f..0241b75 100644 --- a/app/views/marc_downloads/index.html.erb +++ b/app/views/marc_downloads/index.html.erb @@ -4,7 +4,7 @@ <% Dir["public/tmp/records/*.*"].each do |file| %> - + <% end %>
<%= link_to file[/[A-Za-z0-9_\.]*$/], file.gsub('public', '') %><%= link_to File.basename(file), "#{root_url}tmp/records/#{File.basename(file)}" %>
diff --git a/app/views/marc_uploads/index.html.erb b/app/views/marc_uploads/index.html.erb index e287f45..dd35ffc 100644 --- a/app/views/marc_uploads/index.html.erb +++ b/app/views/marc_uploads/index.html.erb @@ -5,7 +5,7 @@

Upload Arkive invoices in *.xlsx format

- <%= form_tag '/marc_uploads/create', { :multipart => true } do %> + <%= form_tag marc_uploads_create_path, { :multipart => true } do %>

<%= bootstrap_flash %> diff --git a/app/views/order_mailer/new_order.html.erb b/app/views/order_mailer/new_order.html.erb index c83937b..2263d8c 100644 --- a/app/views/order_mailer/new_order.html.erb +++ b/app/views/order_mailer/new_order.html.erb @@ -34,6 +34,6 @@

-

<%= link_to orders_path(@order), orders_path(@order) %>

+

<%= link_to order_url(@order), order_url(@order) %>

diff --git a/app/views/orders/_show_admin_actions.html.erb b/app/views/orders/_show_admin_actions.html.erb index 36bee1a..4741c84 100644 --- a/app/views/orders/_show_admin_actions.html.erb +++ b/app/views/orders/_show_admin_actions.html.erb @@ -8,7 +8,7 @@ diff --git a/config/application.rb b/config/application.rb index 58c2407..a95400d 100644 --- a/config/application.rb +++ b/config/application.rb @@ -7,7 +7,7 @@ module SelectorReporting class Application < Rails::Application - config.action_mailer.default_url_options = { host: 'example.com' } + config.action_mailer.default_url_options = { host: 'lucy.libraries.uc.edu' } config.autoload_paths += %W(#{config.root}/app/models/users) # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers diff --git a/config/environments/development.rb b/config/environments/development.rb index 27ff357..c9dbbaf 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -5,7 +5,6 @@ # every request. This slows down response time but is perfect for development # since you don't have to restart the web server when you make code changes. config.cache_classes = false - # Do not eager load code on boot. config.eager_load = false diff --git a/config/environments/production.rb b/config/environments/production.rb index f431b74..7a995b3 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,6 +1,7 @@ SelectorReporting::Application.configure do # Settings specified here will take precedence over those in config/application.rb. + # Code is not reloaded between requests. config.cache_classes = true diff --git a/db/migrate/20140328162816_create_losts.rb b/db/migrate/20140328162816_create_losts.rb index af4f302..4adaf02 100644 --- a/db/migrate/20140328162816_create_losts.rb +++ b/db/migrate/20140328162816_create_losts.rb @@ -3,7 +3,7 @@ def change create_table :losts do |t| t.integer :item_number t.integer :bib_number - t.string :title + t.text :title t.string :imprint t.string :isbn t.string :status diff --git a/db/migrate/20150122191758_create_dda_expenditures.rb b/db/migrate/20150122191758_create_dda_expenditures.rb index 8bd806d..a27a9f4 100644 --- a/db/migrate/20150122191758_create_dda_expenditures.rb +++ b/db/migrate/20150122191758_create_dda_expenditures.rb @@ -1,7 +1,7 @@ class CreateDdaExpenditures < ActiveRecord::Migration def change create_table :dda_expenditures do |t| - t.string :title + t.text :title t.integer :paid t.string :fund t.text :paid_date diff --git a/db/schema.rb b/db/schema.rb index bf7c738..c6ec400 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -14,7 +14,7 @@ ActiveRecord::Schema.define(version: 20150314191530) do create_table "dda_expenditures", force: true do |t| - t.string "title" + t.text "title" t.decimal "paid", precision: 2, scale: 0 t.string "fund" t.text "paid_date" @@ -25,7 +25,7 @@ create_table "losts", force: true do |t| t.integer "item_number" t.integer "bib_number" - t.string "title" + t.text "title" t.string "imprint" t.string "isbn" t.string "status" @@ -77,21 +77,6 @@ t.date "not_yet_published_date" end - create_table "serials", force: true do |t| - t.integer "order_number" - t.integer "bib_number" - t.string "title" - t.string "fund" - t.string "format" - t.string "acq_type" - t.string "order_type" - t.string "vendor" - t.text "payments" - t.text "issns" - t.datetime "created_at" - t.datetime "updated_at" - end - create_table "sierra_indices", force: true do |t| t.string "record_type" t.integer "record_num" @@ -119,7 +104,6 @@ t.datetime "updated_at" t.text "location" t.boolean "lmlo_receives_report" - t.boolean "admin" t.integer "selector_id" t.string "type" end