Skip to content

Instantly share code, notes, and snippets.

Created May 10, 2009 08:58
Show Gist options
  • Save anonymous/109558 to your computer and use it in GitHub Desktop.
Save anonymous/109558 to your computer and use it in GitHub Desktop.
class CourseController < ApplicationController
def new
@course = Course.new
end
def input
@course = Course.new(params[:course])
if @course.save
redirect_to '/'
else
render :action => 'new'
end
def edit
@course = Course.find(params[:id])
end
def update
@course = Course.find(params[:id])
if @book.update_attributes(params[:book])
redirect_to '/'
else
render :action => 'edit'
end
end
--------------------------------------------------------------
<h1>Add your schedule<h1>
<% form_tag :action => 'input' do %>
<p><label for="course_name">Course</label>:
<%= text_field 'course' %></p>
<p><label for="course_name">Course</label>:
<%= text_field 'course' %></p>
<p><label for="course_name">Course</label>:
<%= text_field 'course' %></p>
<p><label for="course_name">Course</label>:
<%= text_field 'course' %></p>
<%= submit_tag "Input your schedule" %>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment