-
-
Save ahoward/e90db9cfab892e2a7d6b899508b4041f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=begin | |
- if we just add a field we need to | |
- avoid adding 'home away properties' to the SearchLocation table | |
file: app/models/search_location.rb | |
def sanitize_location_class(location_type) | |
if ['Property','UnitGroup','Unit'].include? location_type | |
return location_type.constantize | |
else | |
return false | |
end | |
end | |
- avoid showing 'home aways properties' as a Property|UnitGroup|Unit | |
file: app/controllers/locations_controller.rb | |
def sanitize_location_class(location_type) | |
if ['Property','UnitGroup','Unit'].include? location_type | |
return location_type.constantize | |
else | |
return false | |
end | |
end | |
- prevent 'home away properties' from being booked/reserved | |
file: app/controllers/reservations_controller.rb | |
- any problems would manifest as HomeAwayProperty showing in main user interface where it should not, and be booked | |
- if we got with STI we need to | |
- think about moving validations up to PropertyBase | |
file: app/controllers/param_validators/property_type_validator.rb | |
- move /manage/ stuff up to PropertyBase | |
- move perms up PropertyBase, eg app/models/user_admin_state.rb | |
- perhaps simpler to have 2 separate reservation flows: https://kanbanflow.com/t/ea931e03ca57487dd637043d0b2bfac3/add-a-rental-manager-method-to-the-pro | |
- think https://kanbanflow.com/t/ea931e03ca57487dd637043d0b7ee7f2/add-exchange-boolean-to-property-model is a no-op | |
- any problems would be in that the model would be 'too scoped', eg and admin does need to manage both Property and HomeAwayProperty | |
=end | |
class HomeAwayRental < ActiveRecord::Base | |
field :id | |
field :json | |
def data | |
Rails.cache.fetch(data_cache_key){ JSON.parse(json) } | |
end | |
def data_cache_key | |
"#{ cache_key }.data" | |
end | |
end | |
class PropertyBase < ActiveRecord::Base | |
field :type | |
field :rental, :type => Boolean, :default => false | |
end | |
class Property < PropertyBase | |
end | |
class HomeAwayProperty < PropertyBase | |
belongs_to :home_away_rental | |
field :home, :type => Boolean, :default => false | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment