I've tried to share my app with a friend of mine so that he can help
out with development (mostly styling work and other stuff I hate to
do^^) but when I send him the files signup pops up an error in
terminal
1.
Processing Admin::FrontController#index (for 127.0.0.1 at
2010-09-07 15:58:51) [POST]
2.
Parameters: {"page_path"=>"admin/front/index",
"authenticity_token"=>"Pd4O9AWO2a/y5vJEse/ooW8Ng97Ej78vDZ67jz7wfuk=",
"user"=>{"city"=>"Test", "company"=>"test", "name"=>"admin",
"country"=>"pL", "postal_code"=>"00-000",
"password_confirmation"=>"testpass", "street"=>"test street",
"fax"=>"0000000", "telephone"=>"0000000",
"email_address"=>"[email protected]", "vat"=>"0000", "province"=>"test",
"password"=>"testpass", "nip"=>"1234567890"}}
3.
Rendering admin/front/index
4.
User Load (0.1ms) SELECT * FROM `users` LIMIT 30
5.
SQL (0.4ms) SHOW TABLES
6.
SQL (0.4ms) SHOW TABLES
7.
SQL (0.4ms) SHOW TABLES
8.
SQL (0.4ms) SHOW TABLES
9.
SQL (0.3ms) SHOW TABLES
10.
SQL (0.1ms) SELECT count(*) AS count_all FROM `users`
11.
Completed in 597ms (View: 588, DB: 9) | 200 OK [http://localhost/
admin]
I'm not quite sure why is the controller thats being processed is the /
admin one since the user model and controller are still at their
default paths
users table :
#
mysql> show fields from users;
#
+---------------------------+--------------+------+-----+---------
+----------------+
#
| Field | Type | Null | Key | Default |
Extra |
#
+---------------------------+--------------+------+-----+---------
+----------------+
#
| id | int(11) | NO | PRI | NULL |
auto_increment |
#
| crypted_password | varchar(40) | YES | | NULL
| |
#
| salt | varchar(40) | YES | | NULL
| |
#
| remember_token | varchar(255) | YES | | NULL
| |
#
| remember_token_expires_at | datetime | YES | | NULL
| |
#
| name | varchar(30) | YES | | NULL
| |
#
| company | varchar(255) | YES | | NULL
| |
#
| country | varchar(255) | YES | | NULL
| |
#
| province | varchar(255) | YES | | NULL
| |
#
| city | varchar(255) | YES | | NULL
| |
#
| street | varchar(255) | YES | | NULL
| |
#
| postal_code | varchar(255) | YES | | NULL
| |
#
| nip | varchar(255) | YES | | NULL
| |
#
| vat | varchar(255) | YES | | NULL
| |
#
| telephone | varchar(255) | YES | | NULL
| |
#
| fax | varchar(255) | YES | | NULL
| |
#
| email_address | varchar(255) | YES | | NULL
| |
#
| administrator | tinyint(1) | YES | | 0
| |
#
| user_level | int(11) | YES | | 0
| |
#
| created_at | datetime | YES | | NULL
| |
#
| updated_at | datetime | YES | | NULL
| |
#
| state | varchar(255) | YES | MUL | active
| |
#
| key_timestamp | datetime | YES | | NULL
| |
#
+---------------------------+--------------+------+-----+---------
+----------------+
#
23 rows in set (0.00 sec)
users controller
class UsersController < ApplicationController
hobo_user_controller
auto_actions :all, :except => [ :new, :create ]
end
User Model:
class User < ActiveRecord::Base
hobo_user_model # Don't put anything above this
fields do
name :string, :required, :unique, :limit => 30
company :string, :unique
country :string, :required
province :string, :required
city :string, :required
street :string, :required
postal_code :string, :required
nip :string, :required, :unique
vat :string, :required, :unique
telephone :string
fax :string
email_address :email_address, :login => true
administrator :boolean, :default => false
user_level :integer, :default => 0 # dodac limit
timestamps
end
has_many :comments
# This gives admin rights to the first sign-up.
# Just remove it if you don't want that
before_create { |user| user.administrator = true if !Rails.env.test?
&& count == 0 }
# --- Signup lifecycle --- #
lifecycle do
state :active, :default => true
create :signup, :available_to => "Guest",
:params =>
[:name, :email_address, :password, :password_confirmation, :company, :country,
:province, :city, :street, :postal_code, :nip, :vat, :telephone, :fax ],#
<-- added at end of params list
:become => :active
transition :request_password_reset, { :active
=> :active }, :new_key => true do
UserMailer.deliver_forgot_password(self, lifecycle.key)
end
transition :reset_password, { :active => :active }, :available_to
=> :key_holder,
:params => [ :password, :password_confirmation ]
end
# --- Permissions --- #
def create_permitted?
acting_user.administrator?
end
def update_permitted?
acting_user.administrator? ||
(acting_user == self && only_changed?
(:email_address, :crypted_password,
:current_password, :password,
:password_confirmation, :company, :country, :province, :city, :street,
:postal_code, :nip, :vat, :telephone, :fax))
# Note: crypted_password has attr_protected so although it is
permitted to change, it cannot be changed
# directly from a form submission.
end
def destroy_permitted?
acting_user.administrator?
end
def view_permitted?(field)
return true if new_record? # To allow signup
return true if acting_user.administrator? # Admins can view
users
return true if acting_user.id == id # Users can view themselves
false
end
end
Thanks for any and all help
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en.