Allow admin users to load pets
Also allows the new rake task we're building to load, too!
This commit is contained in:
parent
610177d3f5
commit
c76e8cd2a9
2 changed files with 2 additions and 3 deletions
|
@ -2,9 +2,10 @@ class PetsController < ApplicationController
|
|||
rescue_from Pet::PetNotFound, :with => :pet_not_found
|
||||
rescue_from PetType::DownloadError, SwfAsset::DownloadError, :with => :asset_download_error
|
||||
rescue_from Pet::DownloadError, :with => :pet_download_error
|
||||
rescue_from Pet::ModelingDisabled, with: :modeling_disabled
|
||||
|
||||
def load
|
||||
return modeling_disabled unless user_signed_in? && current_user.admin?
|
||||
|
||||
raise Pet::PetNotFound unless params[:name]
|
||||
@pet = Pet.load(
|
||||
params[:name],
|
||||
|
|
|
@ -17,9 +17,7 @@ class Pet < ApplicationRecord
|
|||
joins(:pet_type).where(PetType.arel_table[:id].in(color_ids))
|
||||
}
|
||||
|
||||
class ModelingDisabled < RuntimeError;end
|
||||
def load!(options={})
|
||||
raise ModelingDisabled
|
||||
options[:locale] ||= I18n.default_locale
|
||||
I18n.with_locale(options.delete(:locale)) do
|
||||
use_viewer_data(fetch_viewer_data(options.delete(:timeout)), options)
|
||||
|
|
Loading…
Reference in a new issue