Common signals

szeryf Aug 11, 2009 2 thanks

Some of the more commonly used signals:

 1       HUP (hang up)
 2       INT (interrupt)
 3       QUIT (quit)
 6       ABRT (abort)
 9       KILL (non-catchable, non-ignorable kill)
 14      ALRM (alarm clock)
 15      TERM (software termination signal)

Content type for emails with attachments

garethadams Aug 10, 2009

Be aware that if you want to send emails with attachments, you probably want to use the content type +multipart/mixed+ for the overall email.

The MIME time +multipart/alternative+ is intended for emails where each part is a different representation of the same message.

After following the 2.3.2 do...

Join multiple tables

Ariejan Aug 7, 2009 7 thanks

It's easy to join multiple tables too. In this case we have:

class Article
belongs_to :feed
end

class Feed
has_many :articles
belongs_to :source
end

class Source
has_many :feeds
# t.bool :visible
end

You can search articles and specify a condition...

Built-in cache stores

szeryf Aug 7, 2009

Built-in cache stores are:

  • +:file_store+ (ActiveSupport::Cache::FileStore)
  • +:memory_store+ (ActiveSupport::Cache::MemoryStore)
  • +:drb_store+ (ActiveSupport::Cache::DRbStore)
  • +:mem_cache_store+ (ActiveSupport::Cache::MemCacheStore)
  • +:compressed_mem_cache_store+ (ActiveSupport::Cache::Compre...

Most common use case

szeryf Aug 7, 2009 2 thanks

Most common use case is probably:

Rails.cache.fetch "some key" do
compute some value
end

This computes some value and caches it. Subsequent invocations will return cached value (as long as it is still cached).

Documentation

szeryf Aug 7, 2009 3 thanks

This method only returns a cache manager object of sorts, to see what you can do with it, see ActiveSupport::Cache::Store.

Documentation bug

jneto Aug 6, 2009 4 thanks

When adding the :target option, the documentation states that you should user :href_options like so:

auto_link(post_body, :href_options => { :target => '_blank' })

However, I could only get it to work using :html instead:

auto_link(post_body, :html => { :target => '_blank' })

I'm using Rails 2...

Using YAML

KOTP Aug 3, 2009

=== YAML library must be required.

==== Example to display an array as yaml formatted output

require 'yaml'

puts [100, [99, 98, 97], 96, 95].to_yaml