Stream of Ry

Yet Another Geek In The World

Archive for the ‘Uncategorized’ Category

How to get out of debt by Dave Ramsey

leave a comment

I’m keeping this here as a reminder to myself:

  1. $1000 Emergency Fund
  2. Debt snowball: Start from the small ones
  3. 3 to 6 months of expenses in savings
  4. Invest 15% of income
  5. *College fund
  6. *Mortgage fund
  7. Share

* doesn’t really apply to me yet

You can find out more from his website:

 

Written by rystraum

February 2nd, 2012 at 3:36 pm

Posted in Uncategorized

2 days 1 line: devise_for in different constraints

leave a comment

Here’s an e-mail I sent to the Devise mailing list:

Hi,

I patterned my app to this: https://github.com/RailsApps/rails3-subdomains but using AR instead of Mongoid.
I’m trying to extend it such that a user can log in inside a subdomain and at the main area and different classes will handle sessions/registrations in each context.

Here’s my routes:

  constraints(Subdomain) do
    scope :module => "brand" do
      devise_for :subscribers, :class_name => "User", :module => "brand/devise"
      match "/dashboard" => "subscribers#dashboard"
      match '/' => 'home#index'
    end
  end

  devise_for :subscribers, :class_name => "User"

If I remove the 2nd devise_for, it works in the subdomains but I can’t log in the main domain.

Edit: I partially solved my problem while typing out this mail. Will send it still just in case it helps someone.

Partially, in the sense that I can log in at the subdomain and in the main domain but only Brand::Devise controllers handle both cases.

Changing the routes to this fixed it:

  constraints(Subdomain) do
    scope :module => "brand" do
      match "/dashboard" => "subscribers#dashboard"
      match '/' => 'home#index'
    end
  end

  devise_for :subscribers, :class_name => "User", :module => "brand/devise"

Apparently, you can only specify the same resource (:subscribers in this case) only once and the latest call to devise_for will be the one that will apply, regardless if it is within a constraint or not. My motivations in maintaining the resource is to keep my controllers/views dry.

I’m guessing that putting in different resource names will work. It might become confusing though.

2 days of wracking my brains on this and I only had to move a line out of a block. The joys of programming. Haha.

Rystraum

Written by rystraum

February 1st, 2012 at 7:00 pm

Posted in Uncategorized

Spork and DatabaseCleaner

leave a comment

If you are starting to get an SQlite Error that says you can’t start a transaction within a transaction when running your tests with spork, the culprit may be database_cleaner. You might want to read this for the proper installation instructions.

Written by rystraum

January 6th, 2012 at 10:04 am

Posted in Uncategorized

If you don’t have a hypotheses, you are incapable of failing

leave a comment

Venture Capital: Eric Ries

Written by rystraum

November 28th, 2011 at 11:29 pm

Posted in Uncategorized

Comments are changed

leave a comment

Just a quick update.

Finally got the nested comments to work. Yey!
Changed the theme files based on the Codex Function Reference. :)

Now you can see the reply button, and comments can be nested 5 levels before the reply button disappears on the last level.

Written by rystraum

May 3rd, 2011 at 10:15 pm

Posted in Uncategorized