I have most of my books open as I’m trying to create this app. Still
not sure how to make this work - hopefully some help / hints can get
me further.
First I used the “authorizing users” recipe from Rails Recipes. Though
I did add some more generic type of registration fields (email,
address, etc).
I want the registration form on the main page(index) of the site.
What I have so far is
1- a main controller (with no methods in there , at least none of my
own)
2- a member controller (again no methods there)
3- a member model which contains the password stuff, hash and salt ,
so here is that code:
class Member < ActiveRecord::Base
def password=(pass)
salt = [Array.new(6){rand(256).chr}.join].pack(“m”).chomp
self.password_salt, self.password_hash =
salt, Digest::SHA256.hexdigest(pass + salt)
end
end
4- In the view in “main” I put in:
%= render :partial => “member/register” %>
5- so obviously I created the _register.rhtml partial.
The nice thing is domainname/main pulls up the page with the reg form.
Right now the controller doesn’t seem to be working correctly:
Here is the method:
def register
c = member.new(params[:member])
c.save
redirect_to :controller => “main”
end
I’m getting an error message
undefined local variable or method `member’ for
#MemberController:0x37bc690
Not sure what I"m doing wrong . Then again being a newb , not
entirely sure what I’m doing .
Stuart