|
OK, this is going to make me sound like a rank beginner, but here goes. The past 2 days have been educational. The challenge was to upload and then display images in Rails. Putting them in the Public directory is the obvious choice, but I like everything to be stored in the database, for a number of reasons. First, in a Domino environment it allows for automatic backup via replication. Secondly, in a Domino environment, it puts all program items in one single file. Neither of these apply directly in Rails of course, but habits are hard to break, and even without the replication and unitary file advantages, I still think it's a good idea to have all program assets in as few places as possible.
Thanks to a tutorial at http://railsforum.com I was able to get the basics working without too much trouble. However, I couldn't get the file name and type to automatically populate. I eventually found a Rails Recipe that filled the missing piece with the sanitize_filename method. Now my uploads and display forms work as desired, and I just have to complete the ancillary navigation and administration sections.
Some days I feel like all the interconnected parts of Rails are just like magic. And I suppose by Clarke's Law, it is, since I don't understand it yet. So far I'm still just putting pieces together and seeing what happens. I'm eagerly anticipating the day when I hit the "Aha" moment and it all falls into place. Until then, I suppose I'll just keep tossing things in the air and see how they land.
|