Search
Categories
- Deployment (4)
- Development (63)
- Gems and Plugins (4)
- News (2)
- Projects (4)
- Testing (3)
Most Popular Tags
activerecord architecture collections css database date and time debugging design design patterns DRY ebooks fixtures floating-point numbers formatting framework front page global variables helpers I18n introductory launchpad meta-information migrations model multiplicity mvc MySQL partials production rails 2.0 rails 2.1 Rails 2.2 regular expressions routing rss ruby security setup sql UI upgrading user management validation xml xml builder
Tag Archives: debugging
Conditional Code
You’re writing some code for a new client. Debug statements litter the code. Oops, you sent that to the client. Oops, you’re printing out credit-card numbers. Identity theft ensues. Don’t move to Mexico–you can actually handle this problem in an elegant way by using conditional code statements INSIDE your class … Continue reading
Missing Attribute: foo
Have you ever gotten the cryptic message Missing Attribute: foo in your code? Rails looks for this attribute in your model, and in the database. It might be that you’re trying to access an attribute that you didn’t select! What’s the solution? Use find_by_sql to add that attribute into your find call. Continue reading
Undefined Method Foo
Sometimes, you add an attribute to a class, but when you try and access it, it tells you that the method is undefined. What’s going on? In this article, we discuss a bit about how Rails searches for things (database and code). The answer is probably that you forgot the getters and setters for that attribute! Continue reading
Posted in Development
Tagged activerecord, attributes, debugging, framework, introductory
Comments Off
When New Fails
Sometimes, you say @foo = Foo.new(…) and then @foo.save. But it doesn’t save! In fact, creating the new instance failed! What’s going on? One possibility is that @foo is nil (so it wasn’t created properly). Another possibility is that @foo.id is nil–which means @foo failed validation! Continue reading
Posted in Development
Tagged activerecord, debugging, introductory, new keyword, validation
Comments Off