Created
September 14, 2011 08:56
-
-
Save iwada/1216139 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
this works, details are updated accordingly | |
def fees | |
@pin = Pin.new | |
@title = "Pay Fees" | |
if request.post? | |
pin = Pin.check_pin_value(params[:pin][:number]) | |
user = User.find(current_user.id) | |
amount = params[:pin][:value] | |
if pin.nil? | |
flash.now[:error] = "Unable to Pay Fees,Check You Pin and Make sure it has not been Used" | |
else | |
pin.update_attribute(:status,false) | |
flash[:success] ="Fees Paid" | |
redirect_to fees_path | |
... | |
Nothing is updated here, because the form is submited with a put | |
def register | |
@title = "Register for Course" | |
@course = Course.find_all_by_department_id(current_user.department.id) | |
user = User.find(current_user.id) | |
if request.post? | |
if user.update_attribute(:registered,true) | |
flash.now[:success] = "Registered Successfully for Courses" | |
else | |
flash.now[:error] = "Error Registering for Courses" | |
end | |
... | |
the form_for tag : | |
<%= form_for @course, :url => {:action =>"register"}, :validate => true do |f| %> | |
<% @course.each do |course|%> | |
<b><%= course.name %></b> <br/> | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment