Ruby on Rails
Posted on 2011-09-26
I'm trying to create a form with Rails on windows with APache, I see that Ruby on Rails for windows is running fine. The ruby scripts and codes seems to be working, but it doesn't displays the errors after the validation.
In another instance I'm trying to create a form with Rails using Google Spreadsheet for populating the fields with data, again I feel that scripts are running fine, but it doesn't displays the errors after the validation. Not sure whats the problem.
The rails code is as shown, I am using this script from the previous setup. I am still beginner on Ruby on Rails, any help in much appreciated.
UsersController < ApplicationController
@users = User.all
@user = User.find(params[:id])
if params[:user].nil? #User hasn't filled the form
@user = User.new
else #User has filled the form
user = User.new(params[:user])
user.salt = rand(1000000000)
user.password = Digest::MD5.hexdigest(user.salt.to_s + user.password)
flash[:notice] = 'User was successfully created.'
session[:user_id] = user.id
session[:password] = user.password
else render :action=>"new"
else #User is already logged in flash[:notice] = 'You are already registered.'