Tagged: errors

Interesting testing issue with Rails 2.3.3

I'm not sure if this applies to all the versions of Rails, but right now I'm using the latest 2.3.3. I'm using shoulda to do testing and my code looks like this:

 context "GET show" do setup do @feed = Factory(:feed) get :show, :id => @feed.to_param end should_not_set_the_flash should_respond_with :success should_render_template :show end 

The method I am testing looks like this:

 def show @feed = Feed.find(params[:id]) @entries = @feed.entries respond_to do |format| format.pjs { debugger; render :template => 'feeds/show', :layout => false } format.json { render :json => @feed.as_json } format.html { render :template => 'feeds/show', :layout => params[:layout] || true } end end 

The result of running this test is: Missing template feeds/show.erb in view path app/views

That is very irritating.

I found that if I change the order as below everything works fine:

 def show @feed = Feed.find(params[:id]) @entries = @feed.entries respond...

Continue Reading →

A copy of ApplicationController has been removed from the module tree but is still active! And can’t dup NilClass

If you've been working on Rails 2.3 engines (the new stuff that comes with Rails 2.3 not the old engine plugin) and you start running into either of these errors:

A copy of ApplicationController has been removed from the module tree but is still active! 


can’t dup NilClass 

Don't go find a new job at McDonald's. Read this article and feel the love again.

In fact if you do any engine or plugin or gem development read that article. It will make you happy again.

Continue Reading →

Stupid WTF! ActionView::MissingTemplate Exception: Missing template users/_user.erb

If you've spent much time working with Ruby on Rails and more especially if you've done anything with json you might have run across errors like this:

 ActionView::MissingTemplate Exception: Missing template users/_user.erb 

I was having this problem and doing a lot of cursing which is common when I stay up and write code until 2am which I know I should do and I also know that I shouldn't write really long run on sentences but I do it anyway.

This error is usually the result of some code that looks like this:

 format.json do @user_html = render_to_string( :partial => 'users/user', :object => @user ) render :json => { :success => true, :user_html => @user_html } end 

The cause of this error is that the format of the current request is :json. There isn't an _user.json.erb template so Rails tries to find an _user.erb file. That doesn't exist either and boom you spend the night sounding like a sailor.

Now I don't pretend to be an expert but I ...

Continue Reading →

ERROR: While executing gem (ArgumentError) Illformed requirement

I like to use to deploy my applications because of its simplicity. The other nice thing is that they give you free developer space so if you are just getting an application up and running or just need to show it to a client you can do so without having to pay a bunch of money and spend a bunch of time setting up a VPS.

There are a few issues now and then. Morph has a large number of gems installed by default but occasionally I use one that they don't have. Today I ran into this problem. At first I thought no big deal I can just do a rake gems:unpack and drop the gems into the project and then deploy again.

No go.

Instead I get the following error:

ERROR: While executing gem ... (ArgumentError) Illformed requirement [""= 2.2.2""]

Turns out there is current a bug in Rails 2.1.0 and 2.2.0 that causes the unpack to barf if you specify a version number. Here's the link:

Since I am using the latest version of all the gems, my solution was to temporarily remove t...

Continue Reading →

Plugin Loading for Ruby on Rails has Changed.

I am tired of recreating the login system for Rails for each new project so using the RESTful Rails Authentication Tutorial I created a template project that I can use to create new projects. While adding in the OpenID Authentication component I started getting this error:

/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:376:in `new_constants_in': You have a nil object when you didn't expect it! (NoMethodError)

after I installed this OpenID plugin.

The problem occurs because Rails has changed the way that plugins are loaded. The default folder name was:

I renamed it to:

and everything started working again.

Continue Reading →

Stupid Error That I will Blame on Lack of Sleep

So if you are ever working oh so hard on a ruby on rails application and all of a sudden your application stops working and you have no idea why because the error looks like this:

 /!\ FAILSAFE /!\ Mon Nov 12 17:27:15 -0700 2007 Status: 500 Internal Server Error wrong number of arguments (1 for 0) /Users/jbasdf/projects/indulge/vendor/rails/actionpack/lib/ action_controller/base.rb:513:in `send' ..... 

Step back. Call yourself and idiot and remove the method you just added because you can't ever name a method 'send' in your controller because it overrides default functionality and then pukes all over the place.

Bad programmer ... bad bad programmer.

Continue Reading →

Edge Rails, OpenID and the Dreaded Sorry, the OpenID verification failed” error

We use Edge Rails in our projects. Call me stupid if you like, I like living on the edge (get it?). This desire to push our luck has bitten us a couple of times, but not in any serious way. Not until recently anyway. We use OpenID - another brand new cool technology. The combination of Rails and OpenID has been great.

Then one day it all stopped working and my PPH (Profanity Per Hour) went through the roof. We have Capistrano setup. I had another guy deploy 51week and OpenID stopped working and started giving me the dreaded "Sorry, the OpenID verification failed" error. I deployed it and it started working. "Very strange I thought to myself," but I was just glad it was working. Then Joel starts working on igagus. He can't login because of the dreaded "Sorry, the OpenID verification failed". We make some changes and notice that igagus no longer works.


So I spend some time searching and can't find anything. I spend some time chatting with the Ja...

Continue Reading →