SaltedHashLoginGenerator Integration Woes

I’m trying to modify the SaltedHashLoginGenerator to where it separates
the users table into two tables: a users table which contains login
info: token, salt, etc) and userprofiles table (which contains
firstname, lastname, authlevel, etc)

I’m trying to use the existent helper for user under
app/helpers/user_helper.rb and copied to
app/helpers/userprofiles_helper.rb and prepended prof_ to the names of
the functions to differentiate them.

On the user_controller.rb I added
helper :userprofiles

and modified the app/views/_edit.rhtml to make use of the userprofile
helpers…

I also added: config/environments/userprofile_environment.rb
1 module Userprofiles
2 CONFIG = {
3 # Security token lifetime in hours
4 :security_token_life_hours => 24,
5
6 # Two column form input
7 :two_column_input => true,
8
9 # Add all changeable user fields to this array.
10 # They will then be able to be edited from the edit action.
11 :changeable_fields => [ ‘firstname’, ‘lastname’,
‘phonenumber’, ‘faxnumber’, ‘mobilenumber’, ‘companyname’, ‘email
address’, ‘description’ ],
12
13 }
14 end

But yet I get this error:

uninitialized constant Userprofiles

Extracted source (around line #3):

1: <%= form_input :hidden_field, ‘form’, :value => ‘edit’ %>
2:
3: <%= prof_form_input prof_changeable(userprofile, “firstname”),
“firstname” %>

Any suggestions? Or am I completely going by the the wrong way?

My end result is that whenever a user signs up: A new record is added to
the users table AND a corresponding userprofile record is created as
well.

thanks.

-Lr-

To answer my own question (it’s funny how reading one’s own problem
helps solve it):

I had failed to add the line:

require ‘environments/userprofiles_environment’

in the config/environment.rb file.

No it works I can use the Userprofiles::CONFIG[:etc] in the Helper file!

Hope this helps someone.

-lr-

Lieutenant Ro wrote:

I’m trying to modify the SaltedHashLoginGenerator to where it separates
the users table into two tables: a users table which contains login
info: token, salt, etc) and userprofiles table (which contains
firstname, lastname, authlevel, etc)

I’m trying to use the existent helper for user under
app/helpers/user_helper.rb and copied to
app/helpers/userprofiles_helper.rb and prepended prof_ to the names of
the functions to differentiate them.

On the user_controller.rb I added
helper :userprofiles

and modified the app/views/_edit.rhtml to make use of the userprofile
helpers…

I also added: config/environments/userprofile_environment.rb
1 module Userprofiles
2 CONFIG = {
3 # Security token lifetime in hours
4 :security_token_life_hours => 24,
5
6 # Two column form input
7 :two_column_input => true,
8
9 # Add all changeable user fields to this array.
10 # They will then be able to be edited from the edit action.
11 :changeable_fields => [ ‘firstname’, ‘lastname’,
‘phonenumber’, ‘faxnumber’, ‘mobilenumber’, ‘companyname’, ‘email
address’, ‘description’ ],
12
13 }
14 end

But yet I get this error:

uninitialized constant Userprofiles

Extracted source (around line #3):

1: <%= form_input :hidden_field, ‘form’, :value => ‘edit’ %>
2:
3: <%= prof_form_input prof_changeable(userprofile, “firstname”),
“firstname” %>

Any suggestions? Or am I completely going by the the wrong way?

My end result is that whenever a user signs up: A new record is added to
the users table AND a corresponding userprofile record is created as
well.

thanks.

-Lr-