Archive for » November, 2006 «

Sunday, November 26th, 2006 | Author: Raven

Remember that massive migrate? I skipped it. It didn’t feel good so I switched to a simpler version with each user having a extra email field and a validation field. The usually so simple email validation had to go into a less simple home written validation that checks both fields. I’ve also made a method to create a random string for validation.

I also need to update the tests (I know I should write the tests first but I’m not used to that so it’ll take a while)

Category: stuff  | Leave a Comment
Monday, November 20th, 2006 | Author: Raven

Bara en vinst på 50 kr.

Statistik (v. 47)
Köpt för: 1175kr
Vunnit: 720kr
Vinst%: 61%

Category: stuff  | Leave a Comment
Sunday, November 19th, 2006 | Author: Raven

Just thought I should post the biggest migrate yet :) This one adds a new table for emails and also populates it before removing the email column from User. And it works with both self.up and self.down, although some information is lost on the down-action.

class CreateEmails < ActiveRecord::Migration
def self.up
# create the new table for emails
create_table :emails do |t|
t.column :user_id,      :integer
t.column :email,        :string
t.column :validation,   :string
t.column :created_at,   :datetime
t.column :validated_at, :datetime
end

# transfer all old emails to the new table
User.find(:all).each do |user|
user.emails << Email.new(:email => user.email, :validated_at => Time.now())
user.save
end

# remove the old obsolete column
remove_column :users, :email
end

def self.down
# readd the email column
add_column :users, :email, :string
User.reset_column_information

# readd the last validated email to the user
User.find(:all).each do |user|
user.email = user.last_validated_email
user.save
end

# drop the table
drop_table :emails
end
end

Category: stuff  | One Comment
Sunday, November 19th, 2006 | Author: Raven

The last days I’ve been working on the user model. It’s now possible to register, login, logout and edit your profile. You will also get an email when you register. Next up will be making the email authentication work, for that I’ll need to change the user model some and most likely add a table for emailaddresses.

I’ve also launched the devel-site, skydevel.raven.nu. For now they are almost the same and the live site will probably update almost as often as the devel site. And it isn’t safe to register at either and excpect the details to stuck :)

Category: stuff  | Leave a Comment
Monday, November 13th, 2006 | Author: Raven

So, nothing happend for a while you might think. Well, wrong. I’ve decided to learn stuff before doing them. Ruby is abit from perl and java (that I already know) so the last week I’ve been reading Programming Ruby and Agile web development with Rails. Pretty good books. I know enough not to make stupid misstakes and also what to search for.

I also decided to try out subversion as version control software instead of using cvs as I use to. Installing it took a while but the repository is now accessible via http and controlled in a normal htaccess file. Sweet :)

Category: stuff  | Leave a Comment