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
Author Archives: Ashiq Alibhai
PlainRL 1.0 Released
PlainRL 1.0 is out! Download it now and give it a try–a full, working, albeit plain RogueLike game written entirely in Ruby. Continue reading
Internationalizing Your Rails Application in 34 Languages eBook
We’re very pleased to announce our very on Rails eBook: Internationalizing Your Rails Application in 34 Languages! The goal of this eBook is to help you get your Rails application internationalized–and to kick it off with not one or two, but 34 different languages–all without the expense of hiring a translator! Continue reading
rake secret?
Bort and Restful Authentication, require you to edit the REST_AUTH_SITE_KEY. What does this mean? Rake has a ‘secret’ target which you can call; it generates a key. What about the ‘secret’ value in environment.rb? Added in Rails 2.0, as part of moving session state to the client side, this key encrypts session data. Continue reading
One-Shot Scaffolding Creation
If you’re not that familiar with Rails, you might be creating your application domain entities (models, controllers, business objects, whatever you want to call them) by generating the model, then generating the controller, then populating the fields into the migration, and the new/edit views. There’s a one-line way to do all of this, though. Continue reading
Private Member Variables in Ruby
How can you create private member variables in Ruby? If you’re used to the attr_accessor helper, that won’t work–that makes your member variables public. You can use the @ notation, eg. @variable_name. (Attr_accessor just gives you free getters and setters.) Continue reading
Internationalization (I18n) in Rails 2.2
Rails 2.2 introduces I18n, aka Internationalization, out-of-the-box. Now, it’s very, very easy to write an application that can be translated quickly into another language; all through the new I18n API. You can easily add strings, change strings, even change the language on the fly. We discuss a bit of the evolution of how such a solution came about, which is a common implementation in many programming languages today. Continue reading
Rails 2.1: UTC-Timestamped Migrations
Rails 2.1 introduces UTC-timestamped migrations–instead of a single, three-digit prefix to your number, you now get a timestamp (everything from the current year to the current second). This helps you resolve conflicts of the same-numbered migration showing up in multi-developer environments; but it’s annoying sometimes! How can you turn this off? Through environment.rb! Continue reading
Looping Backwards in Ruby
In Ruby, looping or iterating forwards is a simple task–you can use the bracket notation. But what if you want to loop backwards? Can you do it? Easily? Or what if you don’t know if you’re iterating forwards or backwards? Is there a generic solution you can use for this specific, albeit rare, case? Continue reading
Posted in Development, Projects
7 Comments
The Controversial Eval Function
eval is a function in Ruby that allows you to execute arbitrary code. You pass in a string containing code, and voila! It’s very useful, for things like holding pointers of a sort to functions; but it’s also dangerous, because script-kiddies can format your hard-drive. So what’s the middle-path use-case of eval? Continue reading
Block Comments in Ruby
How do you comment out a chunk of code? Other programming languages (C++, Java, etc.) have a slash-star style of block comments, like so: /* */ … but what about Ruby? Does Ruby have a mechanism for this, too? The answer is YES; BUT, there’s a catch! If you don’t watch whitespace … Continue reading →