Tuesday, December 13, 2011

Trouble with Ruby form methods

I'm still working with my Dungeon Crawler Sinatra app. Believe it or not, I have a problem. I'm trying to get a simple form method working to allow a user to move from one room to another by typing in the direction he wants to move and then hitting 'Submit'. So good so far, right?

Here's a link to a gist of the code I've got so far:

Working with form methods

The second file I posted in the gist is code that works, but I'm looking for a cleaner way of manipulating the information collected from the form method. Does that make sense? This is probably easy enough to do, and @jqr gave me some help with it last week, but I can't figure out how to make these form methods behave.

On a side note, do you have a problem with getting distracted with new ideas for projects when you're in the middle of a project? This seems to happen to me all the time, and I've been handling it by saving as much as I can think of in a Google Doc. I wonder how other programmers handle this? Do you just write things down in a notebook? I've been thinking about creating a template to use for these project ideas, just to keep my thoughts a bit more organized. If any of you have a template like this, or suggestions on what would be key features, I'd love to hear them.

I actually think a simple drawing application that allows me to add notes and save to the cloud would be ideal, but I haven't heard of anything like this.

2 comments:

  1. See if this is helpful: https://gist.github.com/1475149/6d92b7c055315f7d08fa950dec2c10b1b29f1b57

    If it doesn't make sense, let me know. You could go further than I have in refactoring that, too. Basically, try to move all of that functionality into other methods, probably other classes. :-) You might need a "Room" class from which TorchRoom inherits. I have a feeling you already have this, actually.

    I save ideas either in my notebook, or in Evernote, or in a text file, or something like that. (Lately, I'm trying to do Evernote again.) One big page/note/file called "ideas".

    I think you'll find that, thanks to the iPad, there are a ton of sketchpad-type apps that save to the cloud, and some have been 'ported' to OSX proper. Look in the Mac App Store. I searched for "draw", and was overwhelmed with results.

    ReplyDelete
  2. It is, but I've run into a problem. I think what I'm going to do is go ahead and get the entire map working with the ugly version I was complaining about, then go back and try to trim that nasty code down using the examples you posted.

    Also, you're the seconde programmer who's recommended Evernote, so I may look into it. Some kind of basic drawing app for an iPad is more in line with what I want, so I'll have to look into that when I pick up an iPad (finally)

    Thanks for the input, Miles!

    ReplyDelete