Created
September 30, 2011 23:17
-
-
Save kirkconnell/1255287 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| class LocationData::Profiles < ActiveResource::Base | |
| self.schema = Front::PROFILE_SCHEMA | |
| def method_missing(name, *args, &block) | |
| super(name, *args, &block) | |
| rescue NoMethodError, NameError => e | |
| if name.to_s =~ /^(?:county|state|provincial)_profiles$/ | |
| [] | |
| else | |
| raise e | |
| end | |
| end | |
| def state_profiles | |
| super.select{|p| p.site_name != 'ps'} | |
| end | |
| def local_profiles | |
| county_profiles.select{|p| p.site_name != 'ps'} | |
| end | |
| def page_two_profiles | |
| (county_profiles + attributes[:state_profiles]).select{|p| p.site_name == 'ps' && p.confirmed?} | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment