22
Mar 11

Rails 3 Baby Steps – Part 2

Go here if you want to see an index for the entire series.

In the last part of my series on Rails 3, we got up and going with Ruby, RubyGems, RVM, and finally Rails. It may have seemed like a lot of overhead to get up and running, but keep in mind that RVM only needs to be setup once on your machine, then you can use it on as many projects as you would like.

In this part I want to create a single static vertical stripe in the application. We are going to do this by creating a route which will map to the root of our website. We are then going to use the rails executable to generate a controller and some views to go with our route. In this post we are going to focus entirely on getting the entire pipeline running, but without a database at this point.

If you’ve used Rails before, then you probably know that it is big on convention. Everything has a default place, and the project structure is no exception. If you were to open up your project folder, you’ll see this:

image

Sure is a lot of directories! For now, let’s just focus on three of these folders:

Continue reading →


16
Mar 11

Rails 3 Baby Steps – Part 1

Go here if you want to see an index for the entire series.

As you may have seen from many of my past blog posts, I’m a big fan of Ruby. I’ve been a web developer for a long time now, but for the most part I’ve been working solely within the Microsoft .NET world. Over the past few years I’ve been working with ASP.NET MVC heavily for my day to day work, and I love ASP.NET MVC. It is a great framework. However I’ve had my eye on Rails for a long long time, and I even spent a solid chunk of time a few years ago going through “Agile Web Development with Rails” (that is an updated Rails 3 version), but never got into the world of Rails development since my day to day job was on the .NET stack.

Ever since then I’ve been itching to wade back into those waters. Over the past few months I’ve been doing just that, trying to spend some of my free time delving deeper into Rails 3 than I have with any other version. I didn’t want to just slap together a Rails app and say “Done!”, I really wanted to understand the ecosystem and the day-to-day tools that a “real” Rails developer would be using.

Coming into an already mature ecosystem can be a daunting task. Usually the hardest part of it all is trying to filter out the chaff so that you can get to the wheat. If you aren’t familiar with a development ecosystem, you don’t have a good sense for what is needed and what isn’t. You can quickly become overloaded with the minutiae and fail to learn anything. It requires someone with knowledge and time to wade through it and provide you with some guidance.

The problem is, most of the experienced people aren’t interested in blogging about the beginner stuff anymore, they’ve been doing all of this for years, they want to get to the new features and the more advanced stuff that is useful and interesting to them. I hope to help remedy that a little bit with this series.

Over the last few weeks I’ve been digging into Rails 3 in the hopes of getting a grasp on the tools and environment. I’ve avoided blogging about it up until now, but mostly because I didn’t feel like I could be a respective voice on the topic. I’ve had a number of people encourage me to suck it up and just put something out there. So here it goes…

Continue reading →


07
Mar 11

You Really Should Be Using NuGet

If you get one thing out of this post, I want it to be that you need to help spread the word on NuGet.

If you are currently using Visual Studio 2010, you have a very powerful package manager at your fingertips. What is a package manager? Well, you know how when you want to use a third party library you have to go find the website, download all of the files, unzip them somewhere (don’t forget to right click and "unprotect" that zip file!), copy them into your project, add references to them, add some configuration, and then you can finally use your library.

Then when a new version comes out (which you probably don’t know about), you have to do the whole thing all over again! It SUCKS. The Ruby guys haven’t had to deal with this for a loooooong time. It has taken a long time for us to get there.

Continue reading →


22
Feb 11

ASP.NET MVC Ajax CSRF Protection With jQuery 1.5

Wow, what a mouthful that title is! Anyways, if you can decipher the title, then you are in the right place. While working on Epic Win Hosting I decided that I wanted to put some groundwork in place to allow for a much more dynamic site in the future. As a result of that choice, I used Backbone.js for a good portion of the page interactions. If you haven’t used Backbone, then you owe it to yourself to go check it out. I’ll also be sure to blog about it in the near future.

Since I decided to do a good portion of the UI using backbone, and many of the forms that we post use the jQuery forms plugin, I wanted to make sure that we were protected from CSRF attacks that might come in via Ajax calls. Also, since Backbone.js uses HTTP verbs such as DELETE and PUT, I decided that I wanted the same CSRF protection to work for those as well.

Since the default ASP.NET MVC CSRF protection only works with form posts, I knew I couldn’t use it. But at the same time, I didn’t want to develop my own solution, since that is probably almost as dangerous as not doing it at all. Unless you really know what you are doing, you probably want to avoid writing too much security related code. So instead of implementing it myself, I decided to do some surgery.

Continue reading →


20
Feb 11

A New Day, A New Blog

If you’ve been to my blog previously then you might have noticed that things have changed a bit around here. I’ve moved my blog off of BlogEngine.net and onto WordPress. This isn’t a statement about BlogEngine.net, in fact I have had a wonderful experience with it. The move is driven primarily by two different decisions…

  1. I don’t want to host or maintain my blog anymore. I’d rather just pass my blog off to a service and allow them to worry about it. I’ve moved my blog onto WPEngine and at this point I’m happy with it. I’ll report back after I’ve been using the service for a few months and let everyone know how things have been going.
  2. I don’t want to have to customize very much. You just can’t beat the WordPress ecosystem. If I want to do something with my blog, chances are that there are 10 different plugins that do exactly what I want. If I want a theme, there are thousands to choose from. If I need help with something, there are tons of documentation out there.

Things might be changing a bit more over the next few days/weeks so let me know if you see anything that isn’t working quite right and I’ll get it all patched up. Right now the theme I have chosen if very clean and simple. I’m thinking that I might leave the theme this way for a while, let me know what you think of it!

I hope you enjoy the new blog, and I’ll be sure to get some new posts up here for you to enjoy!