tag:blogger.com,1999:blog-165763742024-03-13T03:27:39.165-07:00Learning Ruby on RailsThis blog is for me to put down little snippet of information I gather while I learn Ruby on Rails.Unknownnoreply@blogger.comBlogger65125tag:blogger.com,1999:blog-16576374.post-78776375624958255252008-05-13T22:21:00.000-07:002008-05-13T22:27:59.763-07:00Dreamhost added ability to host Rails app using PassengerI just saw this, <a href="http://blog.dreamhost.com/2008/05/13/passenger-for-ruby-on-rails/">Introducing Passenger for Ruby on Rails</a>, on Dreamhost Blog. This should make deploying Rails applications on Dreamhost really simple now.<br /><br /><a href="http://www.modrails.com/">Passenger</a> is mod_rails for Apache, as stated on their website. Maybe now is the time for me to give Dreamhost a try. I was thinking of installing Passenger on a VPS I use for testing purpose.Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-16576374.post-17674542207481907342008-04-02T18:47:00.000-07:002008-04-02T18:56:22.723-07:00Rails is moving over to GithubIt looks like keeping up with edge Rails for Windows' users will get harder in the very near future. Here is <a href="http://weblog.rubyonrails.com/2008/4/2/rails-is-moving-from-svn-to-git">the post</a> announcing the move from using SVN to Git. I look into using Git on Windows before but it doesn't work well on Windows. It works if you run it on top of cygwin. Otherwise, it is a no go for now.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-16576374.post-26670146955120998122008-03-26T10:23:00.000-07:002008-03-26T10:38:51.232-07:00Developing Ruby on Windows PlatformThere is an interesting discussion over at Ruby Inside regarding "<a href="http://www.rubyinside.com/is-windows-a-first-class-platform-for-ruby-823.html">Is Windows a First Class Platform for Ruby</a>"? I think there are two parts to this question.<br /><br />Windows is definitely viable as a development platform using Ruby. I build and deployed a Rails website using Windows as the development platform. I had a few problems which I was able to overcome by googling around for a patch or two. No show stopper for sure. All the gems I need were working fine on Windows. A big thanks to those maintainers that kept their gems multi-platforms.<br /><br />Windows as a deployment platform. I think this is where I draw the line. I didn't even think for a second about deploying the site on Windows. It is definitely not an option at all. Although, I am looking forward to <a href="http://www.ironruby.net/">IronRuby</a> and its support for Rails. I know one of their goal is to be able to run Rails. IIS 7 is looking quite nice.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-16576374.post-44774307386635488602008-02-04T15:31:00.000-08:002008-02-04T16:39:32.421-08:00form_remote_tag with ajax and none ajax actionDoes anyone else having the same problem as I do when trying to set the url for AJAX and none AJAX actions for the form_remote_tag? I always seem to forget how to do this. It always take me a couple of tries to get this right. Anyway, I am putting the correct way to do this here so I come back later when I forget.<br /><pre><br /> <% form_remote_tag :url => {:controller => '/posts', :action => 'view'},<br />:html => {:action => {:controller => '/posts', :action => 'view', :id => @id}} do %><br /> <%= submit_tag 'View' -%><br /> <% end %><br /></pre><pre><br /><form action="/posts/view/1" method="post" <br />onsubmit="new Ajax.Request('/posts/view/1', <br />{asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;"><br /> <input type="submit" value="View" /><br /></form><br /></pre>Unknownnoreply@blogger.com8tag:blogger.com,1999:blog-16576374.post-23807375504216433442008-01-30T11:25:00.000-08:002008-01-30T11:33:27.113-08:00What happened to nbrubyide daily build?What happened to daily build of nbrubyide? I have been checking the last few days and there is no new build. I am so used to getting my morning nbrubyide fix. This is not a complain. I am just wondering.<br /><br />Here is where I go to download the latest build.<br />http://deadlock.netbeans.org/hudson/job/ruby/changesUnknownnoreply@blogger.com2tag:blogger.com,1999:blog-16576374.post-37268346061802028812008-01-17T23:51:00.000-08:002008-01-17T23:57:41.504-08:00Converts a comma separated string of numbers into an array of integersThis is all there is to convert a string of comma separated integers to an array of integers.<br /><pre><br />>> "1,24,53,6,23,6,5".split(",").collect{ |s| s.to_i }<br />=> [1, 24, 53, 6, 23, 6, 5]<br /></pre><br />This is why Ruby is so fun to use. Is there a shorter way to do this than what I have?Unknownnoreply@blogger.com5tag:blogger.com,1999:blog-16576374.post-60136113234625320642008-01-08T21:45:00.000-08:002008-01-08T21:58:38.800-08:00Expose Module methods as Instance and Class methodsHave you ever wondered how to include a Module and has its methods be available as instance methods and class methods? I certainly did and after doing a little research I figured out a way to do this in Ruby. For the experience Ruby programmers out there, this is probably very obvious but for those that haven't completely figured out Class object and instance of a class then this should help a little. Or totally confused you.<br /><br />I don't know whether it is wise to do this but at least it is possible to do. Anyway, enough talking. Here is the code in all it (not so) glory.<br /><pre><br />module Methods<br /> def self.included(base)<br /> # add methods in ClassMethods into the meta class<br /> base.extend(ClassMethods)<br /> end<br /> <br /> def hi<br /> # accessing the meta class to call the<br /> # real method<br /> class << self<br /> self.hi<br /> end<br /> end<br /> <br /> def bye<br /> class << self<br /> self.bye<br /> end<br /> end<br /><br /> module ClassMethods<br /> def hi<br /> puts "Hello"<br /> end<br /> <br /> def bye<br /> puts "Good Bye"<br /> end<br /> end<br />end<br /><br />class Greeting<br /> include Methods<br />end<br /><br /># Calling Instance methods here<br />Greeting.new().hi<br />Greeting.new().bye<br /><br /># calling Class methods here<br />Greeting.hi<br />Greeting.bye<br /></pre>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-16576374.post-61853655027265951292008-01-05T03:40:00.000-08:002008-01-05T03:44:30.059-08:00Encryption Data in Ruby using OpenSSLI had been searching the web for a way to encrypt some data for my Rails project for a while and I finally found something that I could use. <a href="http://stuff-things.net/2007/06/11/encrypting-sensitive-data-with-ruby-on-rails/">Encrypting Sensitive Data with Ruby (on Rails)</a> has straight forward instructions on how to encrypt and decrypt data using OpenSSL in Ruby.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-16576374.post-56097207598966107312008-01-04T13:55:00.000-08:002008-01-04T14:33:05.993-08:00adding special helpersI was cleaning up my view and decided that I want to add two helpers, display_if and display_unless to help clean up the view.<br /><br />Instead of doing:<br /><pre><br /><% if @login %><br /> Hello <%= @user_name -%>.<br /><% end %><br /></pre><br />It would be like this:<br /><pre><br /><% display_if @login %><br /> Hello <%= @user_name -%>.<br /><% end %><br /></pre><br />I came from the Asp.Net world so writing a custom control to do this is not easy. I was expecting it to be difficult in Rails also but it turned out to be very simple.<br /><br />It took me less than 10 minutes to figure it out from not knowing how to do it at all. Hopefully, I am doing it correctly.<br />Here is the code for the two helpers. Just put them in your application_helper.rb file.<br /><pre><br /> def display_if(condition, &block)<br /> raise ArgumentError, "Missing block" unless block_given?<br /><br /> if condition<br /> output = capture(&block)<br /> concat(output, block.binding)<br /> end<br /> end<br /> def display_unless(condition, &block)<br /> raise ArgumentError, "Missing block" unless block_given?<br /> <br /> unless condition<br /> output = capture(&block)<br /> concat(output, block.binding)<br /> end<br /> end<br /></pre>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-16576374.post-24038851748116924312007-12-30T13:37:00.000-08:002007-12-30T14:04:09.503-08:00Understanding include and extend in RubyI was watching a presentation by Dave Thomas called, "<a href="http://www.infoq.com/presentations/metaprogramming-ruby">MetaProgramming - Extending Ruby for Fun and Profit</a>", and realized that my understanding of include and extend is mixed up.<br /><br /><span style="font-weight:bold;">My Wrong Understanding</span><br /><strike>I thought "extend" will add methods from a module into a class as instance methods and "include" will add them as class methods.</strike><br /><br /><span style="font-weight:bold;">Correct Understand:</span><br />"extend" adds methods from a module into a class as class methods.<br />"include" adds methods from a module into a class as instance methods.<br /><br />It is quite easy to demonstrate this actually.<br /><pre><br />module SomeModule<br /> def hi<br /> puts "hello"<br /> end<br />end<br /><br />class ExtendSample<br /> extend SomeModule<br />end<br /><br />ExtendSample.hi<br /><br />class IncludeSample<br /> include SomeModule<br />end<br /><br />IncludeSample.new.hi<br /></pre>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-16576374.post-35899736162054636032007-12-17T18:03:00.000-08:002007-12-17T18:22:59.227-08:00AUTO_INCREMENT MySQLThere is a bug in MySQL that reset AUTO_INCREMENT if an index is added and the table is empty. I found a <a href="http://dev.rubyonrails.org/ticket/8918">ticket</a> regarding this issue in Ruby on Rails' bug tracker but it won't be fix because it is a MySQL bug.<br /><br />Anyway, I reset AUTO_INCREMENT to my desire value after adding indexes to the table and that seems to work. Just remember to not add anymore indexes to the table after you set the AUTO_INCREMENT value or else it will be reset again.<br /><br />Here is how to set the value manually.<br /><code><br />execute "ALTER TABLE table1 AUTO_INCREMENT = 100"<br /></code>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-16576374.post-35108378061228005582007-12-14T00:26:00.001-08:002007-12-14T00:36:11.754-08:00added method to help create and drop foreign keyWe have a naming convention at my work place for foreign key so I made two methods to help in the creation and dropping of foreign key. I made them because I got tired of typing out the query everytime.<br /><br />We name our foreign key like this: fk_table_column_reference_table_column. So a foreign key from a "users" table to the "employers" table would look like this. fk_users_employer_id.<br /><br />This is how you call the method to create a foreign key.<br /><br /><code><br />create_foreign_key(:users, :employer_id, :employers, :id)<br />drop_foreign_key(:users, :employer_id)<br /></code><br /><br /><code><br /> def create_foreign_key(table, column, foreign_table, foreign_column)<br /> execute "ALTER TABLE #{table.to_s} ADD CONSTRAINT fk_#{table.to_s}_#{column.to_s} FOREIGN KEY (#{column.to_s}) REFERENCES #{foreign_table}(#{foreign_column})"<br /> end<br /><br /> def drop_foreign_key(table, column)<br /> execute "ALTER TABLE #{table.to_s} DROP FOREIGN KEY fk_#{table.to_s}_#{column.to_s}"<br /> end<br /></code>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-16576374.post-26439111438070009052007-12-10T13:58:00.000-08:002007-12-10T14:22:59.218-08:00NetBeans 6 - Out of Memory ExceptionLately, I have been getting Out of Memory Exception every time NetBeans load up. This is the exception message, "java.lang.OutOfMemoryError: Java heap space". I am using the daily build of the custom ide for Ruby development.<br /><br />I fixed the problem by setting the max heap size to a 512 MB. This is how I start the ide.<br /><br />nbrubyide.exe -J-Xmx512m<br /><br />UPDATE: I just found out that I can set the max heap size in the nbrubyide.conf file. It is in the etc directory under c:\nbrubyide <br />I modified it to<br /><br />default_options="-J-Xms24m -J-Xmx256m"Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-16576374.post-79299021051287556482007-12-07T13:23:00.000-08:002007-12-07T13:26:37.687-08:00Rails 2.0.1 is outI am sure this is all over the web but Rails 2.0.1 is out and here is the <a href="http://weblog.rubyonrails.org/2007/12/7/rails-2-0-it-s-done">announcement</a>. I probably won't use it for my current project until after we do a release.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-16576374.post-2421095639468807832007-12-03T14:52:00.001-08:002007-12-03T15:03:28.446-08:00Mongrel installed in wrong location?I just reinstall my rails stack to use ruby 1.8.6 and mongrel wouldn't start. I kept getting this error instead.<br /><br />C:/languages/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require': no such file to load -- C:/languages/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.1-x86-mswin32-60/lib/mongrel/init.rb (MissingSourceFile)<br /><br />Which is strange since Mongrel is one of the install gem when I do gem list. Here are my install gems.<br /><br />*** LOCAL GEMS ***<br /><br />actionmailer (1.3.6)<br />actionpack (1.13.6)<br />actionwebservice (1.2.6)<br />activerecord (1.15.6)<br />activesupport (1.4.4)<br />capistrano (2.1.0)<br />cgi_multipart_eof_fix (2.5.0)<br />gem_plugin (0.2.3)<br />highline (1.4.0)<br />mongrel (1.1.1)<br />needle (1.3.0)<br />net-sftp (1.1.0)<br />net-ssh (1.1.2)<br />rails (1.2.6)<br />rake (0.7.3)<br /><br />I can see mongrel is installed under mongrel-1.1.1-mswin32 but the system was trying to look for mongrel under mongrel-1.1.1-x86-mswin32-60.<br /><br />I rename my mongrel directory to mongrel-1.1.1-x86-mswin32-60 and everything works. I wonder if I did something wrong or Mongrel just installed in the wrong directory. I am using gem 0.9.5 and it just figures out the correct version of mongrel and install it by itself so I didn't have the chance to pick which version of mongrel I wanted to install.Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-16576374.post-45958426682783968702007-07-17T13:58:00.000-07:002007-07-17T14:07:31.849-07:00NetBeans IDE 6.0 M10 is outNetbeans 6.0 M10 is out. There are many editing and debugging improvement for RHTML files. Here is the <a href="http://wiki.netbeans.org/wiki/view/NewAndNoteWorthyMilestone10#section-NewAndNoteWorthyMilestone10-Ruby">new feature sections for Ruby development</a>.<br /><ul><br /><li>Find Usages</li><li>Rename Refactoring</li><li>RHTML support<ul><li>Debugging (breakpoints, stepping etc. in RHTML files)</li><li>Code completion</li><li>Go to declaration</li><li>Find Usages</li><li>Rename</li></ul></li><li>Improved code completion - attributes, Rails migrations, models and views now include all the expected methods, etc.</li><li>Enhanced RDoc rendering; embedded Ruby and RHTML code fragments are now syntax highlighted</li><li>Debugger enhancements (global vars, watch view, locals view)</li><li>Encoding support (projects now have an encoding property)</li><li>Basic RSpec and ZenTest support (More Info), basic RJS support</li><li>JRuby 1.0 is bundled </li><br /></ul>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-16576374.post-46137867690270958172007-07-17T13:41:00.000-07:002007-07-17T13:56:35.668-07:00Developing ROR using EmacsI saw a few screencast on using Emacs to do ROR development but I was not able to setup emacs to try it out until I saw this five part series on setting up Emacs for Ruby on Rails development from <a href="http://sodonnell.wordpress.com/">Software bits and pieces</a>.<br /><br /><a href="http://sodonnell.wordpress.com/the-emacs-newbie-guide-for-rails/">http://sodonnell.wordpress.com/the-emacs-newbie-guide-for-rails/</a><br /><br />After following guide step by steps I was able to get emacs up and running for developing ROR. Initially emacs started up with an error and it wasn't able to go into ROR mode. I found out I was missing inf-ruby which you can get it <a href="http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/misc/inf-ruby.el?view=co">here</a>. If you following the tutorial then put this file in your c:/emacs-22.1/includes/ directory. After putting the file there, everything works.<br /><br />I found another site, <a href="http://www.credmp.org/">credmp</a>, also with instructions on how to setup emacs for ROR development. <a href="http://www.credmp.org/index.php/2006/11/28/ruby-on-rails-and-emacs/">Ruby On Rails and Emacs</a> It also list out the snippets that the emacs-rails supports.Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-16576374.post-5304248205723776612007-07-02T22:05:00.000-07:002007-07-02T22:11:24.704-07:00Build FaceBook Application using RailsHere are links to two blog articles on how to build FaceBook application using Rails.<br /><br />From GIANT ROBOTS SMASHING INTO OTHER GIANT ROBOTS:<br /><br /><a href="http://giantrobots.thoughtbot.com/2007/6/14/fist-in-your-facebook">fist in your facebook</a><br /><br />From Liverail >> Rails with currents:<br /><br /><a href="http://www.liverail.net/articles/2007/6/29/tutorial-on-developing-a-facebook-platform-application-with-ruby-on-rails">Tutorial on developing a Facebook platform application with Ruby On Rails</a>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-16576374.post-92119024564228635652007-06-19T15:24:00.000-07:002007-06-19T15:36:11.830-07:00Where to put the codeThat is the question I ask all the time while developing in Rails. Should I put the code in the helper or in the model or in the controller itself. I guess I need to find some advance Rails reading material. On that note, <a href="http://www.robbyonrails.com/">Roby on Rails</a> has a collection of links to making the model fat and the controller skinny. <a href="http://www.robbyonrails.com/articles/2007/06/19/put-your-controllers-on-a-diet-already">Put Your Controller on a Diet already!</a><br /><br />After reading those blog posts, I am seeing myself putting some serious time in slim up my controllers. They are a little on the heavy side for sure.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-16576374.post-26489893174393294962007-05-08T12:43:00.000-07:002007-05-08T13:11:50.878-07:00observe_field and radio_buttonI had a group of radio buttons that I wanted to trigger some action when one of the button is selected. I setup an observe_field for each radio button but it didn't work. You can't specify observe_field to monitor a group of radio buttons. It would only monitor the first button. Actually, let me clarify that statement. It would work the first time a user click on the button but then subsequence click would not register as something has changed. Apparently, it keeps the last value and when the radio button is selected again, the last value and the current value is the same. That result in a no change. I ended up using onclick with remote_function to trigger the change event.<br /><br />This is what I had and it doesn't work.<br /><pre><%= radio_button_tag 'ship_method', 'pickup', :checked => true -%> Pickup<br /><br /><%= radio_button_tag 'ship_method', 'deliver' -%> Deliver<br /><br /><%= observe_field 'ship_method_pickup',<br />:url => { :controller => 'checkout', :action => 'ship_method_select' },<br />:on => 'click', :with => 'method' -%><br /><br /><%= observe_field 'ship_method_deliver',<br />:url => { :controller => 'checkout', :action => 'ship_method_select' },<br />:on => 'click', :with => 'method' -%><br /></pre>This is what I ended up with<br /><pre><input type="radio" name='ship_method' id='ship_method_pickup'<br /> checked="checked" value="pickup"<br />onclick="<%=<br />remote_function(<br />:url => {:controller => 'checkout', :action => 'ship_method_select', :method => 'pickup'}<br />)-%>" /></pre>Unknownnoreply@blogger.com7tag:blogger.com,1999:blog-16576374.post-91352928096773061942007-05-07T00:55:00.000-07:002007-05-08T13:58:47.306-07:00How to pass a class or id to link_to_remoteThis does seem like a really simple thing now that I figured out how to do it.<br /><pre><%= link_to_remote 'Name',<br />{:url => {:controller => 'some_controller', :action =>'some_action', :id => some_id}},{ :class => 'some_class' }-%></pre><br />If you want to specify a fall back url for href instead of the default # you can put that in the html_options part also.<pre><%= link_to_remote 'Name',<br />{:url => {:controller => 'some_controller', :action => 'some_action', :id => some_id}},<br />{:class => 'some_class', :href => url_for({:controller => 'some_controller', :action => 'some_action', :id => some_id}) }-%></pre>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-16576374.post-45786036866803850942007-05-05T20:48:00.000-07:002007-05-05T21:08:07.248-07:00NetBeans IDE 6.0 M9 is outI just saw that NetBeans 6 Milestone 9 was released. Go <a href="http://wiki.netbeans.org/wiki/view/NewAndNoteWorthyMilestone9">here</a> to see all the changes for M9. There are many new features added for Javascript. You can edit embedded Javascript and CSS inside HTML/JSP. Of course, there are new features for Ruby editing.<br /><br />Here is the list of changes for Ruby from the site.<br /><blockquote><ul><br /><li> Advanced code editing: Code completion, Documentation Popup, Semantic highlighting (such as unused local variable coloring), Parameter Hints, Instant Rename, Goto Declaration, Live Code Templates, Mark Occurrences, Reformatting, Pair Matching, Smart Selection, Surround With </li><br /><li> Project support: Create and run files, run unit tests, run RSpec specifications, jump between files and their testcases, Ruby Gems support, ability to use any version of either JRuby or native Ruby </li><br /><li> Ruby Debugger, including Rails debugging - run/step, breakpoints, local variables, call stack, thread switching, balloon evaluation, etc. Support for native fast debugging. </li><br /><li> Ruby On Rails support: Code Generator wizard, Database Migrations, Rake Targets, Support for generator plugins, Jump between Action and View, RHTML highlighting </li><br /></ul></blockquote><a href="http://bits.netbeans.org/download/6.0/milestones/latest/">Download</a> and try it out for yourself.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-16576374.post-37457686348008480862007-04-01T01:11:00.000-07:002007-04-01T15:00:51.095-07:00NetBeans IDE 6.0 M8 is outI just installed <a href="http://wiki.netbeans.org/wiki/view/MilestoneDownloads">NetBeans IDE 6.0 M8</a> and noticed that you can start and stop WEBrick within NetBeans now. Before this release, you would have to kill the java task from the task manager which was a pain. I actually didn't use WEBrick within the ide because of this problem. Instead, I just run it from the command line using the native ruby interpreter instead of jruby.<br /><br />Before I was able to use the WEBrick instance started by NetBeans, I need to setup the project to use the jdbc adapter for MySQL. Since I didn't really bother reading much instruction, I encountered quite a few problems.<br /><br />Here are the steps I used to get everything working.<br /><br />1. Modify environment.rb and add these lines in right before Rails::Initializer:<br /><pre><br />if RUBY_PLATFORM =~ /java/<br /> require 'rubygems'<br /> RAILS_CONNECTION_ADAPTERS = %w(jdbc)<br />end<br /><br />Rails::Initializer.run do |config|<br /></pre><br />2. Modify database.yml to use the jdbc adapter. Of course, instead of test_development, you put your own database name there.<br /><pre><br />development:<br /> adapter: jdbc<br /> driver: com.mysql.jdbc.Driver<br /> username: root<br /> password: password<br /> url: jdbc:mysql://localhost:3306/test_development<br /></pre><br />3. Download the JDBC driver for MySQL.<br /><a href="http://dev.mysql.com/downloads/connector/j/5.0.html">Download Connector/J 5.0</a><br />Unzip or untar the archive and copy mysql-connector-java-5.0.5-bin.jar to your jruby-0.9.8\lib.<br /><br />You can find your jruby-0.9.8 directory under<br />C:\Documents and Settings\<your username>\.netbeans\<br /><br />I found this step to be quite important because adding the driver to CLASSPATH did not work for me.<br /><br />NetBeans also exposed more rake tasks than before.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-16576374.post-74539583336717858192007-03-21T10:40:00.000-07:002007-03-21T11:16:16.760-07:00How to use migrationYavor Ivanov over at <a href="http://rubycorner.net/">rubycorner.net</a> started a mini series on Rails migration. So far there is one article and I already learned a few things that I didn't know.<br /><br /><a href="http://rubycorner.net/articles/how-to-use-rails-migrations-part-i/">How to use Rails Migrations - Part I</a><br /><br />I created a table with :created_at column as :null => false but I didn't define the default value so I was having problem with specifying the datetime in my test fixture.<br /><br />I solved that problem by putting this in my test fixture:<br /><pre>created_at: <%= DateTime.now.strftime('%y-%m-%d %H:%M:%S') %></pre>What I really should have done is created the column like this.<br /><pre>t.column :created_at, :datetime, :default => Time.now</pre>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-16576374.post-28517661511570473342007-03-20T16:20:00.000-07:002007-03-20T16:24:42.578-07:00Ruby on Rails CachingGregg Pollack over at <a href="http://www.railsenvy.com/">Rails Envy</a> posted two articles on Ruby on Rails Caching. If you have performance issue, you might want to check them out.<br /><br /><a href="http://www.railsenvy.com/2007/2/28/rails-caching-tutorial">Ruby on Rails Caching Tutorial - Part 1</a><br /><br /><a href="http://www.railsenvy.com/2007/3/20/ruby-on-rails-caching-tutorial-part-2">Ruby on Rails Caching Tutorial - Part 2</a>Unknownnoreply@blogger.com0