ruby extend versus include

So…you want to add a module to your ruby class, huh?

Touche! It appears that if you want to add ‘just functions’ here’s how

module FunctionsAndConstants
  CONSTANT='3' 
  def a end
end
class B 
 include JustFunctionsend
end
b_instance = B.new()
b_instance.a() 
B::CONSTANT # '3'

however if you want to add class functions use extend but define them as normal functions

module JustClassStuff  
 def class_method  end
end
class C 
 extend JustClassStuff
end
C.class_method

however.

http://www.rubycentral.com/pickaxe/classes.html

substruct


Not Found

The requested URL /store/checkout was not found on this server.Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.means ‘you need to setSubstruct.override_ssl_production_mode = true in your environment.rb (at the bottom where it already is set). 

php replacement for fcgi

So…fcgi doesn’t work? Stuck with cgi, as in hostgator? Well you could try this experimental simple_proxy which attempts to (and poorly does) replace fcgi. It also has the added benefit of attempting to rewrite your url’s should you have any that are ‘hard coded’ so that you can use a rails app within a directory.

It is sweet.

To come should I ever be free with my time: auto-starting mongrel, doing some house keeping on it, etc.


http://ruby-roger-useful-functions.googlecode.com/svn/trunk/forward.php

To use it in .htaccess

RewriteEngine On
RewriteRule ^(.*)$ forward.php [QSA,L]
(not perfect, I know)

substruct tips

If it errs on db half-way through–did you follow the instructions to the letter, so that you have the right environment.rb which defines some constants at the bottom?It just doesn’t start:are you sure it is starting in the right ‘mode’? (development versus production)are you sure the #! all say ruby, in your public directory?It doesn’t show the first page–just a default.Did you copy over the files, exactly as specified?Note it doesn’t work with rails 2.0 yet. rake doesn’t work: use v. 0.7.3  as a last resort, Check your error logs (?)