SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    Mal Reynolds Mandibal's Avatar
    Join Date
    Aug 2003
    Location
    Columbus
    Posts
    718
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re-Launched my PHP->Rails site

    Just launched my rebuild of my website. It's a dynasty manager, tracks all the stats from playing dynasty mode in EASports NCAA football series. Originally the site was PHP and I had used Mojavi to build it. Great at the time but once it became clear that Mojavi was mired down in development and I began to find it's shortcomings, then I was disappointed in having commited all my time to using it to build the site. Considered refactoring the site to Symfony. I think those guys are on the right track. But in the end decided to learn Ruby and Rails and after 6 months, a full time job, a 5 month old son and lots of late nights I finally finished the thing. I don't think even with refactoring to Symfony I could have done it that quickly with the time constraints I'm under without using Rails.

    Couple things that I really learned to love about the Rails framework:

    1) Unit testing built in.

    This has been so helpful. The site is still buggy because I was rushing things at times and I'm the only developer but without unit testing it would probably really be a mess. I don't have 100%, or even 90% but what I do have has made it much easier to fix things and know if I have broken something important instead of rolling out a fix that broke one of the main functions of the site but I never checked it. My only complaint is that I'm having issues running rake test as opposed to just using "ruby test/functional/blah_controller_test.rb". I get errors with "rake test" that I think have to do with fixtures that I don't get using just ruby command with the test file.

    2) AJAX support and RJS templates

    Both make it so much easier to do some cool and interesting stuff with the UI. This is an area I could probably do more with and the whole site could use some refactoring to make using RJS templates in particular more consistant so that things like confirmation messages on CRUD actions are more consistant.

    Other than that it has been an interesting experience learning both Ruby and Rails. I look at the code I first wrote 6 months ago and I see how I was still writing code like I would if I was using PHP and it's fun to rewrite it in a more Rubyish and Rails way.

    I guess another complaint I would have is that it doesn't seem like the View/Template system is as DRY is it should considering that's one of the driving principles of the framework. I have looked and looked for explanations and information on how this could be done better but have come up dry so to speak. This comes into play largely with a lot of the views for the data I'm displaying. For instance, if I'm displaying a players ratings from the game I want to be able to use one template file to display the form and the non-form view. I wrote my own helper to do this but I don't think it's the best written thing for the job. It seems like this would be a more common situation and it would have been solved in a Rails way but so far I've had no luck finding anything.

    Finally, I'm using Apache/mongrel_cluster to serve the app as described here. So far it seems to running well. Still probably need to do some performance testing to see how it would stand up to heavy use but I don't forsee the app really getting heavy traffic. Probably won't even get moderate traffic since it's for a niche group.

    That's about all I have. Just thought I'd share my experience and thoughts now that my first RoR site is launched.
    Erh

  2. #2
    SitePoint Zealot Taranis's Avatar
    Join Date
    Aug 2002
    Location
    Franklin, TN
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Mandibal
    This comes into play largely with a lot of the views for the data I'm displaying. For instance, if I'm displaying a players ratings from the game I want to be able to use one template file to display the form and the non-form view.
    I take this to mean the displaying of data and then displaying that data in a form so that the user can edit the data? Is that what you meant? If so, there is a nice chapter/recipe in the Rails Recipes book about "in-place editing" that might be just what you need.

    As to the rest of your post, this is some nice first-hand experience. Thanks for sharing.

  3. #3
    SitePoint Member
    Join Date
    Jun 2005
    Location
    Eastbourne, UK
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This comes into play largely with a lot of the views for the data I'm displaying. For instance, if I'm displaying a players ratings from the game I want to be able to use one template file to display the form and the non-form view
    What I usually end up doing is having a _form.rhtml partial that can serve as both the new/update form. Then you can just have some logic in the view that decides which partial to pull in. Seems to work quite well.

    As Taranis also mentioned, edit-in-place for simple forms can help a lot too. It can provide a much smoother experience for the user when done well.

  4. #4
    Mal Reynolds Mandibal's Avatar
    Join Date
    Aug 2003
    Location
    Columbus
    Posts
    718
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the replies.

    Edit in place is great but only for pretty specific pieces of data. Many of the forms are pretty large with up to 20 fields or more. Edit in place isn't really efficient for data entry in those cases. I do use the same form for new/edits.

    Most of the data can be and is displayed in exactly the same structure, usually tables, so it just seems like there should be an easier way to display either a form or the data using the exact same template file so I wouldn't need to maintain two templates for basically the same set of data. I created a helper method called edit_or_view that looks for an editing flag to determine if it should show a form for the object attributes or just show the data from the object. Maybe that's the best that can be done?
    Erh

  5. #5
    SitePoint Member
    Join Date
    Jul 2006
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question And your site is?

    Very richful experience indeed. Can you post a link to your site please?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •