Category: Rails

Permissions Issues

Read in 1 minute

We’ve all had it; you put a website on the server and are hit with odd issues which, after much toil and trouble, come down to being all about file permissions. Recently, after putting a Rails application on to a server, I started getting the following error ActionView::Template::Error (No such file or directory – Asset…

Read More

Ruby on Rails in cPanel

Read in 1 minute

Recently, during a subcontract job, I had cause to use cPanel to set up Ruby on Rails for an app; the contractor I was working with was using UKHost4u who only support it via this method. After a few trials and tribulations, I managed to get a working application running through Mongrel. Now, to get…

Read More

The error occurred while evaluating nil.[]= in Integration Tests

Read in 1 minute

If you’re recieving HTTP 500 errors during your integration tests on Rails, here’s a gotcha. If you’re running version 2.x, dig into your test.log. If you find Status: 500 Internal Server Error CGI::Session::CookieStore::CookieOverflow You’ve come across this lovely bug. The fix is pretty simple luckily enough; add the following to your /config/environments/test.rb: ActionController::RackRequest::DEFAULT_SESSION_OPTIONS[:database_manager] = CGI::Session::ActiveRecordStore…

Read More

Be Careful with Ruby’s Array Uniq! Method

Read in 1 minute

Got slightly caught up today whilst using the uniq! method on a Ruby array. I expected it to exhibit the same behaviour as Array#uniq, just in place (uniq goes through an array and returns an array with no duplicate elements). So, by that logic, `[“1”].uniq!` would return `[“1”]`. However, that’s not the case. `[“1”].uniq!` actually…

Read More

Beautiful Sums

Read in 1 minute

I’m always on the lookout for beautiful shorthand in Rails and recently I found something lovely in the `Rails#Enumerable` package. If I have a number of records with an attribute (like “amount”, which contains some sort of number) I wish to sum up, I can so this. payments.sum(&:amount) This is because the above is shorthand…

Read More

Rails on Apache: Malformed Header from Script

Read in 1 minute

So, you’ve just pushed your site onto your production server and you’re getting something like the below: [error] [client xxx.yyy.zzz.xxx] malformed header from script. Bad header=[“a”]: dispatch.fcgi It’s likely you’re code is trying to write out something before it delivers a webpage. Check your code for `puts` statements. This includes your helper methods, which is…

Read More
狠狠热精品免费视频,久久这里只有精品,国产精品视频在线观看