Ever wanted to have your app virus-scan uploads BEFORE you attach them to a model? My BigAuthor app for writers and agents needed to do exactly that — I didn’t want some bozo uploading a virus-laden Word doc and then distributing to all the agents that log in to the site. So I set to [...]
Posts Tagged ‘ruby’
Mongoid + Carrierwave + Virus scanning!
Posted: 30th December 2010 by M. E. Patterson in CodingTags: clamav, inherited_resources, mongoid, rails, ruby, virus
Nested forms, hashes, checkboxes and MongoMapper
Posted: 20th February 2010 by M. E. Patterson in CodingTags: inherited_resources, mongod, mongomapper, rails, ruby, solr, sunspot
While working on my upcoming BigAuthor project, I came upon an interesting challenge that turned out to be so simple with MongoMapper that I just have to share it here. Need to create a hash of multiple filter parameters on a MongoMapper document using a form that is cleanly resource-based, using InheritedResources? It’s not as [...]
Why use HAML (and SASS)? I already know HTML.
Posted: 2nd February 2010 by M. E. Patterson in CodingTags: haml, rails, ruby, sass
The title of the post is more-or-less a verbatim quote from a coworker, as well as from an unrelated colleague of mine from a previous job. I was asked that question and, to be honest, I was a little thrown both times. I didn’t actually know why I use HAML. I guess I’d never really [...]
Mongo Beauty #1
Posted: 2nd February 2010 by M. E. Patterson in CodingTags: mongodb, mongomapper, ruby
Frequently, while working with MongoDB and MongoMapper, I run across an implementation of something that blows me away with its beauty. This, my friends, is one of those times. Given: a Users collection where the users’ names are stored in an Array key called name. i.e. :name => ["Patterson", "Matt"]. It can be any length, [...]
Mongosphinx with MongoDB and MongoMapper
Posted: 20th January 2010 by M. E. Patterson in CodingTags: mongodb, rails, ruby, sphinx
Can that title have the word ‘mongo’ in it any more times? Well, fear not, I’m about to use it even more… So, I had to fool around a bit to get the so-called “Mongosphinx” gem working with my app architecture. Thought it might be helpful to others to demonstrate how I did it. I’ll [...]
Rails Metal + Thin = no ‘each’ for String?
Posted: 17th January 2010 by M. E. Patterson in CodingTags: rails, ruby, thin
Just solved an interesting problem when using the latest Thin web server (1.2.5) with Ruby 1.9.1 and Rails Metal. The code in Rails Metal endpoint: def call(env) if env["PATH_INFO"] =~ /^\/tags.txt/ request = Rack::Request.new(env) params = request.params query = params[’q'] [...]
Put all this crap in your ~/.aliases file. Do it! alias migrate="rake db:migrate db:test:prepare" alias remigrate="rake db:migrate && rake db:migrate:redo && rake db:schema:dump db:test:prepare" alias gadd="git add -u && git add . && git status" alias svnprecommit="git svn rebase && rake features && rake test" alias cuc="cucumber -r features" alias g="git" alias tu="ruby_test unit" alias [...]
Installing CRM114 on OS X Snow Leopard
Posted: 6th January 2010 by M. E. Patterson in CodingTags: crm114, os x, ruby
Here’s what I had to do to get it working: Install ‘tre’ – but *don’t* use macports; tried that and it bombed, instead do: wget http://crm114.sourceforge.net/tarballs/tre-0.7.5.tar.gz tar zxvf tre-0.7.5.tar.gz cd tre-0.7.5 ./configure make && sudo make install Install ‘crm114′ wget -m -np http://crm114.sourceforge.net/src/ Follow Directions! now, follow these directions Enjoy!