So you want threads in rails? Add the following 2 lines to your production.rb file:
config.threadsafe!
config.eager_load_paths << "#{RAILS_ROOT}/lib"
For more reading, checkout: http://m.onkey.org/2008/10/23/thread-safety-for-your-rails
Friday, 20 November 2009
Tuesday, 27 October 2009
Rails: Unpacking your gems into vendor/gems
Okay you have your marvelous gem but want to put it into the vendor directly.
No worries. In this example I will be working with the "marc (0.3.0)" gem.
Troubleshooting. If this doesn't quite work, you might want to try:
No worries. In this example I will be working with the "marc (0.3.0)" gem.
- Edit the environment.rb file and under the "Rails::Initializer.run do |config|" put the following line: config.gem 'marc'
- Next "rake gems:unpack GEM=marc" where GEM=gem_name - don't worry about the version number.
Troubleshooting. If this doesn't quite work, you might want to try:
- Create the gems directory under vendor yourself
- It may complain that it lacks the specification file. If so go to the vendor/gems/gem_name directory and run: gem specification gem_name > .specification
Labels:
rails
Monday, 26 October 2009
Viewing RDoc for installed gems
Pretty simple:
gem server
It's then available on localhost:8808
Pretty cool. It's like having available doc for JAR files. Sort of.
gem server
It's then available on localhost:8808
Pretty cool. It's like having available doc for JAR files. Sort of.
Labels:
ruby
Wednesday, 21 October 2009
Metaprogramming in Ruby is awesome
Well I had to override the behaviour of the Oracle Enhanced Adapter when creating sequence names. By default it creates them as "tablename_seq" where our database was "sq_tablename".
After reading this post. I made my change and placed it under the config/initializers directory.
But the concept of metaprogramming in Ruby is really intriguing.
After reading this post. I made my change and placed it under the config/initializers directory.
But the concept of metaprogramming in Ruby is really intriguing.
Monday, 19 October 2009
Netbeans Ruby Oracle OCI Mac Problem
Okay. You are using netbeans and connecting to Oracle. You have installed the Oracle Instant Client and have set the DYLD_LIBRARY_PATH='/instantclient' in your shell. All is well if you run your rails app from the command line.
Right.
But when you run it through Netbeans you get the error telling you to some effect:
"ERROR: ActiveRecord oracle_enhanced adapter could not load ruby-oci8 library. Please install ruby-oci8 library or gem."
The explanation is that for some reason Netbeans on the mac does not pick up the settings set say in your .bashrc file. The easiest solution is to add the line:
"source ~/.bashrc" to your netbeans startup script.
Now Netbeans will pick up all your paths.
Right.
But when you run it through Netbeans you get the error telling you to some effect:
"ERROR: ActiveRecord oracle_enhanced adapter could not load ruby-oci8 library. Please install ruby-oci8 library or gem."
The explanation is that for some reason Netbeans on the mac does not pick up the settings set say in your .bashrc file. The easiest solution is to add the line:
"source ~/.bashrc" to your netbeans startup script.
Now Netbeans will pick up all your paths.
Labels:
rails
Subscribe to:
Posts (Atom)
