December 2010
8 posts
Saving embedded attachments with Mongoid and...
While developing our latest application, we discovered that Mongoid doesn’t save embedded objects when their parent is saved. On the GitHub page of this issue there were suggested some solutions and it appears that one posted by mcasimir works very well.
What happened to be the next problem is that with this solution comes the issue with saving attachments’ filenames. We’ve...
Thought of the day:
Each time someone thinks it’s a good idea to create model without timestamps or use habtm instead of hmt - Mighty God kills little kitten.
Transfering databases from one development machine...
http://proxylocal.com/
http://adam.heroku.com/past/2009/2/11/taps_for_easy_database_transfers/
Those two solutions can be easily combined to transfer mysql database from one development machine to another (no more nasty dump emailing/sending/sharing etc.)
On first machine:
taps server mysql://db_user:db_pass@localhost/database_name online_user online_pass -p 5000
proxylocal 5000
Last command...
ThinkingSphinx - delta field name
set_property :delta_column => 'another_delta_field'
Adding this property to sphinx indexes on your model allows you to use different field name then ‘delta’ for delta indexing - useful when two stages of your application share the same database.
FQL in Fgraph
Very simple way to use FQL in Fgraph (https://github.com/jugend/fgraph) with query caching.
require 'digest/sha1'
module FGraph
class Client
def fql(query)
@cached_query ||= {}
@cached_query[Digest::SHA1.hexdigest(query)] ||= HTTParty.get("https://api.facebook.com/method/fql.query", :query => {:query => query, :access_token => self.options[:access_token], :format =>...
Interactive Web apps - brainstorming @ Netguru
Small brainstorming about solutions to do even more interactive Web apps.
An easy way to do JavaScript - CoffeeScript...
A short introduction to new great tool which is CoffeeScript.
My .irbrc file.
This is how my irbrc file looks like:
if ENV.include?('RAILS_ENV') && !Object.const_defined?('RAILS_DEFAULT_LOGGER')
require 'logger'
RAILS_DEFAULT_LOGGER = Logger.new(STDOUT)
end
require 'rubygems'
require 'wirble'
require 'interactive_editor'
ActiveRecord::Base.logger = Logger.new(STDOUT) if Object.const_defined?('ActiveRecord')
Wirble.init
Wirble.colorize