Archive for the 'ruby on rails' Category

Custom validation with rails: words with more than 26 characters

Friday, March 21st, 2008

This validation goes through and validates each individual word in your string. This goes in whatever model you’re validating. “Subject” can be any of the symbols in your model and doesn’t need the : in front of it.

def validate
if subject.split.any?{|w| w.length > 26}
errors.add(:subject, “cannot have words more than 26 consecutive characters”)
end
end

Custom errors on validations for Rails

Wednesday, March 12th, 2008

The default Rails way of doing validate error messages is sort of silly. It works, but it doesn’t work that well. You can iterate through all the error messages in a very constrained way (error_messages_for) or you can display errors on fields one by one (error_message_on). I kind of want functionality from […]

Create a preview page in Ruby on Rails

Friday, February 29th, 2008

I searched so long and hard for this and now feel compelled to post it here with some good keywords so that others can find it.
I wanted to create a preview page for my form submission in rails. I found a couple people who had tried some stuff, but none of the examples were […]

multipart in start_form_tag

Tuesday, April 25th, 2006

I was using file_column today in Ruby on Rails and ended up with the error:
Do not know how to handle a string with value ‘my_fruity_graph.png’ that was passed to a file_column. Check if the form’s encoding has been set to ‘multipart/form-data’.
The problem is obvious.. enctype=”multipart/form-data” was not part of the form_tag.
Now how to get that […]

Rails on Fedora + Plesk Fiasco

Tuesday, March 28th, 2006

Wow. I have spent at least the last week trying to get rails to work the way I wanted it to on my Fedora box with Plesk. This morning I finally got it working. You may be very interested in this article if you’re wondering about any of the following:

The mysterious Application […]

Oh how I hate Internet Explorer

Sunday, March 12th, 2006

Internet Explorer is such a worthless piece of shit. Nobody should use it as a browser. Ever. For any reason whatsoever.
For those of you who are not web developers I’m sure you won’t understand my pain, but let me assure you that if you ARE an Internet Explorer user, webdev or not, […]

Ahh!*(@#& SQL and Rails..

Thursday, March 9th, 2006

So. The issue:
I couldn’t get the radio_button or check_box tags to work with rails. They kept telling me:

wrong number of arguments (0 for 1)

Which didn’t make any sense since I was supplying arguments correctly. I eventually tried making a radio_button in a different view and it worked fine. I found out […]

Static pages and content in Ruby on Rails

Thursday, March 9th, 2006

one of the most amazing frameworks for dynamic content.. and what’s my problem? i cant figure out where the hell the best place is to place static content.
my first thought was “sure i could just dump a file in /app/views”. seems like a reasonable solution.. but of course rails won’t route that correctly.
so […]

MySQL Query Browser Alternatives

Friday, February 24th, 2006

I’ve been messing around with MySQL Query Browser.. Quite honestly it’s a piece of shit. Actually kinda surprises me that MySQL even came up with the damn thing. I haven’t been too impressed with MySQL/InnoDB lately either.. but.. yeah.. anyway. So I’ve been having problems with it and doing foreign key stuff […]

jEdit Tutorial: A How-To on Abbreviations in Superabbrevs for HTML, Ruby on Rails and more

Sunday, February 19th, 2006

Who is this tutorial for?

jEdit lovers who have yet to discover the power of abbreviations and the SuperAbbervs plugin.
Those new to jEdit who want to give it some killer functionality
People looking for documentation or a manual on how the hell to use Abbreviations and SuperAbbrevs
Those looking for yet another reason to switch to jEdit, one […]