Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
class School < ActiveRecord::Base
extend FriendlyId
friendly_id :name, use: [:slugged, :history]
has_many :reviews
has_many :prices
# sunspot search
searchable do
text :name, :locality
end
# Beräknar medelvärdet för alla recensioner
def avgerage_review_rating
return nil if reviews.blank?
reviews.average(:rating)
end
def count_checkins(name)
u = @current_user
u.@facebook.fql_query("SELECT checkins FROM page WHERE name = #{name}")
end
# Beräknar antal recensioner
def count_reviews
reviews.count
end
def sum
prices.min + prices.littin + prices.risk1 + prices.risk2 + prices.hyrbil + 1550
end
def facebook
@facebook ||= Koala::Facebook::API.new(oauth_token)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.