Created
December 7, 2014 18:15
-
-
Save bhserna/64205209d808df07ff81 to your computer and use it in GitHub Desktop.
This file contains 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 EventsController < ApplicationController | |
def create | |
@event = Event.new(event_params) | |
if @event.valid_for_creation? | |
@event.save | |
redirect_to event_path | |
else | |
render :new | |
end | |
end | |
end | |
class Event < ActiveRecord::Base | |
def valid_for_creation? | |
add_errors(EventCreationValidatior.errors_for(self)) | |
errors.emtpy? | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment