Hi,
I'm quite new to Ruby on Rails so please bear with me :)
I'm processing an imported .csv file in Rails and I want to programatically create new users (I'm using the AuthLogic Gem along with Role Requirement), So Far I'm using:
Example Line:
[email protected], Steve, Jobs, 555-APPLE
Code:
def new_user(line)
params = Hash.new
params[:user] = Hash.new
params[:user]["email"] = line[0]
params[:user]["first_name"] = line[1]
params[:user]["last_name"] = line[3]
params[:user]["phone"] = line[4]
user = User.new(params[:user])
user.save
end
The problem being that this doesn't add a new user, it tries to but fails (DB Begin followed by Rollback), I assume because I'm not filling in all the fields, such as login, password etc.
Do I have to explicitly generate values for these fields?
Any help would be greatly appreciated