Archive for December, 2007
Tuesday, December 18th, 2007
using authentication with acts_as_authenticated
Problem
You want to use the easiest authentication method, in order to add users/permissions to your application.
Solution
Install the act_as_authenticated plugin:
script/plugin install http://svn.techno-weenie.net/projects/plugins/acts_as_authenticated
Generate controllers, models and migration:
script/generate authenticated user account
Add necessary user foreign keys in appropriate tables (ie customer in xxx_create_users.rb), plus other fields you may want to use in your user table (ie role):
create table “users”, [...]
No Comments » - Posted in ruby on rails by kosmas
Monday, December 3rd, 2007
ArgumentError (3 elements of civil date are necessary)
Problem
On creating a default date on a model using the after create, and by using Model.date_field = ‘2007-01-01′ we get the error ArgumentError (3 elements of civil date are necessary)
Solution
The workaround is to use:
Model.date_field = Date.civil(2007,01,01)