Chronicling my experiences with ruby on rails, web application development/management.

Saturday, April 25, 2009

Rails Template FTW

Boy oh boy, rails templates kick ass. I just made a template that has everything i need to start an user authenticated monthly subscription rspec app.


What's this template got that i ain't got?


Other then charisma and a good sense of style, it has


  • Restful_authentication w/ AASM && will_paginate - creates your User and Session automatically
  • Active_Merchant - sets you up for adding monthly subscription code
  • Subdomain_fu - allows for easy account creation with subdomains.
  • Testing: Rspec, Cucumber, machinist, faker, factory_girl too
  • rspec scaffold an account model to begin your journey


Rails templates are good to get you going but they are just a starting point, you still need to add certain bits of code to make stuff work, like
require 'aasm'
to your config/environment.rb file.


How to Rock the Template


Type the following into your console
rails -m http://github.com/nerbie69/rails-templates/restful_merchant_account.rb app_name_here -d postgresql
Remember that the code above will create a postgres based rails app, so supply whatever DB flag you want, mysql, couchdb etc, and replace app_name_here with whatever you want to call you app.

Wednesday, April 15, 2009

Rails Visionaries - Gems/Plugins Top Contributors

The following is a list of the people/companies whom i feel are leading the pack when it comes to the most useful gems and/or plugins. My criteria is that the gem/plugins are almost KEY to any rails app that needs them, and that this person/company has more then ONE key gem/plugin. FYI - I left out DHH, he gets enough accolades. Let's begin



  1. Technoweenie github repo - Where would a lot of rails apps be without restful_authentication and attachment_fu, just to start. When you add in Acts_as_paranoid and his work with Mephisto, we owe this dude a big thanks for making components of what we do in rails easier and more efficient.

  2. thoughtbot github repo - This company keeps pumping out hit after plugin/gem hit. In the field of testing, they help simplify our testing needs by putting out shoulda and factory girl. In the authentication field, they gave us clearance and paperclip. In the error notification field, they offer hoptoad, (which is rad).

  3. mbleigh github repo - Now mbleigh is a dude that should get mad props, and you should get to know his work, if you aren't familiar yet with him. Essential gems/plugins such as subdomain_fu and twitter_auth are just two of his current 24 projects he has on his repo. When you add acts_as_taggable_on and his ubercool uberkit (for easier form and menu creation), you realize how truly original his work is to our community.

  4. Phusion github repo - Passenger makes all production app serving easier. Back in the day, it was mongrel that made things easier... things keep evolving. However, i can't see how it could get any easier beyond Passenger, which makes setting up your slice/VPS extremely easy. And from their website they describe the Ruby Enterprise Edition as Transparently improve scalability and efficiency of Ruby on Rails web applications.

  5. Shopify github repo - If you handle anything to do with ecommerce you must bow at the generosity of the shopify folks. You have active_merchant, active_fulfillment and active_shipping. easy enough to use, powerful and well thoughtout and maintained.


Honourable Mention


There is no question to the visionary impact that these individuals have made to the rails community and furthering it's progress. In the spirit of this post however, these luminaries have given us fantastic testing apps, while this post was looking at those who have given us more then just one type of gem/plugin.



  • aslakhellesoy github repo - Cucumber is making BDD testing easier for everyone. A killer gem that makes learning testing palatable.

  • dchelimsky github repo - RSpec. enough said. (I do realize it is a team of core dev's who create this, but for clarity purposes, his name is usually at the forfront of any rspec conversation).

  • thinking_sphinx github and acts_as_ferret github - Good search plugins and gems. You are either a Ferret guy or a Sphinx guy.


Well that is the list. Enjoy

Tuesday, April 14, 2009

Struggles with webrat via cucumber

I know that this will end up being pebkac... but it still is annoying


So i have a problem. webrat is not acting how i thought it was supposed to. Ryan Bate's railscast on cucumber made this shit look so easy. And for the most part, it is.

However, when you go beyond what he had in his railscast - beginning cucumber, webrat takes me off the rails very fast.


to the Code...


all i wanted to do was select my choice from a dropdown menu. According to webrat/cucumber webrat_steps.rb file it should be
I select "option" from "field"


So in my scenario, i used the field name "tweet[style_id]" and the option "story".
I select "story" from "tweet[style-id]"
You may be wondering what that tweet[ ] business is all about, well that was the only way my scenario would go green, is if i used the label name in that style of code. Since i am not using a symbol in my
f.label :body, "I want to show this text" if you were simply using f.label :body, you wouldn't need the tweet[ ] syntax.


Updates

i did find this ruby forum post, however he simply had the wrong description text. Since my text is one word, and i copied and pasted from the view source code, i don't think that is my problemo. Maybe i should try using the label field without the quotes?

Friday, April 3, 2009

Weekend Rails Challenge #1

Thanks for participating in the first ever Weekend Rails Challenge.


The rules are simple for this challenge:
You have 48 hours to code a "For-Profit" based rails app using the twitter api. Also your app must have a colour scheme revolving around the following hex code #7C6D8A. Lastly you app Must be online and useable, hosted by yourself of course on your vps slice or node.
The challenge will run for a month and a winner will be chosen based on the app which gains the best combined score based on five different criterion.


Judging the winner



The winning app will have demonstrated the best TOTAL score of the following criteria:


  • (20%) Quality of Code - Following the rails mantra of DRY and readability, a mark will be given to you based on how well your code follows these coding principles. Usually you would test along the way but we've decided that in 48 hours that is not mandatory for this challenge.

  • (20%) Site Popularity - The site with the highest Alexa ranking at the end of the month will receive a full 20 points, 18 for the second best rank, down to 12 for the worst ranked site. 5 bonus points are rewarded for a mention in twitters sidebar menu (located below the profile of a twitter user)

  • (10%) Site Look and (10%) User Interface/Interaction - The site with the best looking and most functional user interface will gain top points in this category. Places 2nd, 3rd, and 4th will recieve 2 points less then the preceding ranking

  • (20%) Revenue made in a month - The site with the most revenue made during the month will gain top points in this category. Places 2nd, 3rd, and 4th will recieve 2 points less then the preceding ranking.

  • (20%) Most Creative Use of the given rules - An app that demonstrates the most creative and functional use of the given rules will gain top points in this category. Places 2nd, 3rd, and 4th will recieve 2 points less then the preceding ranking.




How will the scores be judged?


No idea, but i know that we participants will vote and we'll ask someone or a few people from ROR to vote on things like coding, site look and feel and creativity.


Submission Deadline:


We'll report back who ends up in the final challenge eventually, but if you want to enter, you MUST post a comment below regarding the purpose or solution you came up with for your app by 12 noon, as of you own time zone, on Saturday April 4th.



Good Luck Challengers


Best of luck and hey who knows... you could get a great money making app out of it. At worst, you made some new friendships and had a good weekend coding and learning.