Skip to content

Commit

Permalink
[BUG] Remove unscoped library_locations calls and replace default sco…
Browse files Browse the repository at this point in the history
…pe with specified sort order
  • Loading branch information
Tom Reis committed Jan 12, 2018
1 parent c67e8cf commit 300a551
Show file tree
Hide file tree
Showing 13 changed files with 206 additions and 121 deletions.
2 changes: 1 addition & 1 deletion app/controllers/admin/library_locations_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Admin
class LibraryLocationsController < BaseController
def index
@library_locations = current_organization.library_locations.unscoped.order(:sort_order)
@library_locations = current_organization.library_locations
render layout: "admin/base_with_sidebar"
end

Expand Down
17 changes: 17 additions & 0 deletions app/models/contact.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# == Schema Information
#
# Table name: contacts
#
# id :integer not null, primary key
# first_name :string(30) not null
# last_name :string(30) not null
# organization :string(50) not null
# city :string(30) not null
# state :string(2) not null
# email :string(30) not null
# phone :string(20)
# comments :text not null
# created_at :datetime not null
# updated_at :datetime not null
#

class Contact < ActiveRecord::Base
validates :first_name, presence: true, length: { maximum: 30 }
validates :last_name, presence: true, length: { maximum: 30 }
Expand Down
3 changes: 2 additions & 1 deletion app/models/library_location.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
# created_at :datetime not null
# updated_at :datetime not null
# organization_id :integer
# sort_order :integer default(0)
#

class LibraryLocation < ActiveRecord::Base
belongs_to :organization
validates :name, :zipcode, presence: true

default_scope { order(:name) }
default_scope { order(:sort_order) }
end
1 change: 1 addition & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
# date_of_birth :datetime
# grade :integer
# quiz_responses_object :text
# program_id :integer
#

class User < ActiveRecord::Base
Expand Down
2 changes: 1 addition & 1 deletion app/views/devise/registrations/_new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<% if current_organization.branches? && current_organization.library_locations.present? %>
<div class="form-group">
<%= label_tag "chzn", "Select Your Library", class: "screen-reader-text" %>
<%= p.collection_select(:library_location_id, current_organization.library_locations.unscoped.order(:sort_order),
<%= p.collection_select(:library_location_id, current_organization.library_locations,
:id, "name", { include_blank: "#{t('login_signup.your_library')}" },
class: "select-large", id: "chzn" ) %>
</div>
Expand Down
2 changes: 1 addition & 1 deletion config/deploy/staging.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
set :bundle_without, %w{production test}.join(" ")

set :branch, "release-2.6.1"
set :branch, "release-2.6.2"

server "dl-stageapp-01.do.lark-it.com",
user: fetch(:application),
Expand Down
Loading

0 comments on commit 300a551

Please sign in to comment.