Skip to content

Commit

Permalink
Always show the next 3 meetups, even when more have been announced
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Julian committed Jan 25, 2015
1 parent 95e33bc commit 56f8f38
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/controllers/pages_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class PagesController < ApplicationController
def home
@members = Member.list.shuffle
@meetups = Meetup.most_recent.reverse
@meetups = Meetup.upcoming.limit(3)
end
end
6 changes: 2 additions & 4 deletions app/models/meetup.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
class Meetup < ActiveRecord::Base
UPCOMING_EVENTS_URL = 'http://api.meetup.com/2/events?group_id=347566&status=upcoming&order=time&limited_events=False&desc=false&offset=0&format=json&page=20&fields=&time=%2C5w&sig_id=9347737&sig=f6274cfd7bf5c34df7ec77400585d13b00a0666e'

scope :upcoming, -> { where('time > now()') }

def clean_description
return '' unless description
Sanitize.clean(description)
Expand All @@ -10,10 +12,6 @@ def google_map_url
URI::encode("https://maps.google.com/maps?ie=UTF8&q=#{venue_lat},#{venue_lon}&z=18")
end

def self.most_recent
order('time DESC').limit(3)
end

def self.update
fetch_upcoming_meetups.each do |api_meetup|
api_venue = api_meetup['venue']
Expand Down

0 comments on commit 56f8f38

Please sign in to comment.