Skip to content

Instantly share code, notes, and snippets.

@danhere
Created January 21, 2011 07:50
Show Gist options
  • Save danhere/789382 to your computer and use it in GitHub Desktop.
Save danhere/789382 to your computer and use it in GitHub Desktop.
<%= form_for @live do |f| %>
<%= render "shared/error_messages", :target => @live %>
<%= f.label :title, "Title of Event:" %>
<%= f.text_field :title %>
<br />
<%= f.label :content, "Any Additional Content:" %><br />
<%= f.text_area :content %>
<br />
<%= f.label :link %><br />
<%= f.text_field :link %>
<br />
<%= f.submit "Submit" %>
<% end %>
def show
@live = Live_Result.find(params[:id])
respond_with(@live, :location => live_path)
end
def new
@live = Live_Result.new
respond_with(@live, :location => new_live_path)
end
def create
@live = Live_Result.create(params[:live])
if @live.save
flash[:success] = "Upcoming meet succesfully added!"
respond_with(@live, :location => live_index)
else
flash[:error] = "That didn't go as well as planned. Try again."
respond_with(@live, :location => live_index)
end
end
resources :live, :as => 'live', :controller => "live_results"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment