Skip to content

Instantly share code, notes, and snippets.

@emarashliev
Created May 10, 2010 18:58
Show Gist options
  • Save emarashliev/396377 to your computer and use it in GitHub Desktop.
Save emarashliev/396377 to your computer and use it in GitHub Desktop.
class Offer < ActiveRecord::Base
belongs_to :offer_type
belongs_to :offer_rate
belongs_to :city
belongs_to :location
...
end
module ApplicationHelper
def get_city_name(id)
city = City.find(id)
city_name = city.name
Unicode::downcase(city_name)
Unicode::capitalize(city_name)
rescue
city_name = ""
end
#Get Location Name
def get_location_name(id)
location = Location.find(id).name
Unicode::downcase(location)
Unicode::capitalize(location)
rescue
location = ""
end
#Get OfferType Name
def get_offer_type(id)
offer_type = OfferType.find(id).name
rescue
offer_type = ""
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment