Only confirmed events in JSON API

This commit is contained in:
Ancor Gonzalez Sosa 2013-07-16 18:42:22 +02:00
parent 08637503e5
commit 7f3c8a65de
2 changed files with 3 additions and 1 deletions

View file

@ -6,6 +6,6 @@ class Api::V1::EventsController < Api::BaseController
unless params[:conference_id].blank?
events = events.where("conferences.guid" => params[:conference_id])
end
respond_with events
respond_with events.confirmed
end
end

View file

@ -27,6 +27,8 @@ class Event < ActiveRecord::Base
validates :title, :presence => true
validates :abstract, :presence => true
scope :confirmed, where(:state => "confirmed")
state_machine :initial => :new do
state :new
state :review