This is just a list of notes, problems and solutions I encountered / found from creating a Rails 3 application, and getting it to run in Apache, on my new server. They are categorized by the aspect of the project they pertain to. Expect this list to grow, as I organize all the scattered links I visited.
CSS:
CSS classes do not work when they begin with a number (http://www.yoursiteisvalid.com/validnews/css-class-not-working-when-name-begins-with-numbers-1000.html).
Javascript / Dojo Toolkit:
A list of all the options available for xhrPost/xhrGet (http://dojotoolkit.org/reference-guide/dojo/xhrGet.html#dojo-xhrget). Specifically, I used the sync option in order to block execution until the AJAX call returned. By the way, xhrPost and xhrGet are Dojo calls you use to issue a POST or GET, AJAX-style. AJAX is an asynchronous way of refreshing the page, parts of the page, or just to send information back to the server or get information from the server, without doing a full-fledged POST or GET, where the whole page gets refreshed (http://dojotoolkit.org/reference-guide/quickstart/ajax.html).
The Dijit Editor, a fancy textarea for fancy input (http://dojotoolkit.org/reference-guide/dijit/Editor.html).
Dojo does not have a validating textarea. Instead, use the last post found at http://bugs.dojotoolkit.org/ticket/6388.
Dojo.query, a useful function for getting DOM nodes (http://docs.dojocampus.org/dojo/query).
The Dijit Layout ContentPane cannot execute javascript. To execute javascript within a ContentPane, either use the Dojox Layout ContentPane, or use dojo/method as the type in the script tag (http://dojocampus.org/content/2008/07/30/executing-javascript-inside-content-panes/).
Loading the library one file at a time takes more time than loading the library as one big file. To build a custom dojo, so that it is one big file, with no comments, and other space-saving measures applied, see http://dojotoolkit.org/reference-guide/build/index.html#build-index. Specifically, minified means that variable names are replaced by shorter ones, and optimize contains other options for saving space.
Simple but impressive preloading overlay (http://www.sitepen.com/blog/2008/10/06/implementing-a-web-application-preloading-overlay/).
Server / Apache / Passenger / Capistrano:
Capistrano does not work with Rails 3, as far as I can tell. I tried following the guide, and could not get through the whole thing without errors. Instead, I switched to Passenger, which runs very well, and was easy to get up and running (http://www.modrails.com/documentation/Users%20guide%20Apache.html) or (http://www.modrails.com/documentation.html)
Running a Rails application on Passenger, using a custom port (http://renderedtext.com/blog/2009/09/14/running-a-rails-app-on-passenger-on-a-different-port/).
Rails 3 / Authlogic:
I personally use Authlogic in conjunction with cancan, easy_roles, and declarative_authorization. There was a package which combined the first three (authcan_easyroller - https://github.com/topherfangio/authcan_easyroller), but it didn't work on Rails 3, for me. It had a whole lot of issues, also, and didn't seem to be very customizable. So, I installed the three gems separately.
The guide to walk through setting up Authlogic (https://github.com/binarylogic/authlogic_example#readme).
If you get a "No generator named ***** found" error when running rails generate, then add
gem "rails3-generators"
to your Gemfile and run
bundle install
or
bundle update
. (http://www.ruby-forum.com/topic/204464).
If you get a "No credentials provided" error when running the application, add the following lines to the UserSession model:
def to_key
self.keys.to_a
end
self.keys.to_a
end
An alternative solution is to use the most up-to-date code, and not the outdated gem.
By default, Rails automatically pluralizes the table names in the database. To turn it off (http://devilelephant.blogspot.com/2007/01/rails-plural-table-names-lame.html), add
ActiveRecord::Base.pluralize_table_names = false
to the config/environment.rb file.
To get a list of all the table names from the specified database in your application (found in database.yml), use the following command:
ActiveRecord::Base.connection.tables
(http://rubylove.info/post/903216569/list-tables-rails).
Other:
Funny post after solving the problem of creating a zip file using a gem in Ruby (http://erratic.inkdeep.com/2006/10/17/joy-of-rubyzip/). He put into words the feelings I had when I first started working with this language. Now, I've become one of "them".
Updated on March 14, 2011