Skip to content

Instantly share code, notes, and snippets.

@patrickberkeley
Created March 17, 2009 14:41
Show Gist options
  • Save patrickberkeley/80566 to your computer and use it in GitHub Desktop.
Save patrickberkeley/80566 to your computer and use it in GitHub Desktop.
<% form_for(@event) do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :title %><br />
<%= f.text_field :title %>
</p>
<p>
<%= f.label :permalink %><br />
<%= f.text_field :permalink %>
</p>
<p>
<%= f.label :description %><br />
<%= f.text_area :description %>
</p>
<p>
<%= f.label :start_date %><br />
<%= f.datetime_text_field :start_date, :blank => true %>
</p>
<p>
<%= f.label :end_date %><br />
<%= f.datetime_text_field :end_date, :blank => true %>
</p>
<p>
<%= f.label :location %><br />
<%= f.text_area :location %>
</p>
<p>
<%= f.submit button_name, :class => "button" %>
</p>
<% end %>
<%= link_to 'Cancel', events_path %>
class Event < ActiveRecord::Base
validates_presence_of :title, :permalink
validates_datetime :start_date, :allow_nil => true, :allow_blank => true
validates_datetime :end_date, :allow_nil => true, :allow_blank => true
def to_param
permalink
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment