Merb interactive mode:
merb -i
'readline' required
To fix this, get another copy of the Ruby interpreter source code
and recompile it from
source with the --with-readline-dir=/usr option - see
blog.fiveruns.com/2008/3/3/compiling-ruby-rubygems-and-rails-on-ubuntu
Got ruby-1.8.7-p72.tar.gz from the ruby-lang website and untarred it -
|
That's a lot just to print 'hello world'...
Migrations - making the database fit the Ruby code
Started merb, added a few fields to model article.rb, and generated a 'migration' which is supposed to add the new columns to the database:
|
Doesn't the migration generator know how to name its migrations?
rake db:automigrate
to put the new columns in the table
|
Couldn't find out how to create the test database
So I dumped the development database into a file and loaded
it into the test database before running the tests:
mysqldump -u root db_development > db.sql
and loaded db.sql into the test database from within mysql:
source db.sql
This message, from one of the creators of Merb,
groups.google.com/group/merb/msg/b3895050349fbe87
says
merb-gen resource Page title:string body:text
should be written as:
merb-gen resource Page title:string,body:text
... This is probably quite poorly documented at the moment
A bit of an understatement! I know it's free, but
we are spoiled Rails hackers, (web development that doesn't hurt).
Merb is web development that does hurt.
Guess which one of these commands works?
|
If you guessed the last one, you have what it takes to be a Merb developer - you're good at guessing
After that, do
rake db:automigrate
to create the table
Unlike Rails, the Merb generator doesn't have a scaffold generator so you can't start using the app a minute after creating it.
However, this link
wiki.merbivore.com/howto/simple_new_view
gives an example of a simple page to create a new article, so
I used it.
By the way, I created this site using the Rubymine editor from JetBrains. Best Ruby IDE I've seen.
After a lot
of messing about with different AJAX editors, ended up
using TinyMCE for editing articles.
tinymce.moxiecode.com/
One thing that is easier with Merb
is imposing a style on all pages.
All I have to do
is write a header and footer in application.html.erb
and make sure the following is in the middle of this file:
<%#= message[:notice] %> <%= catch_content :for_layout %> |
The text you are reading is the contents of more.html.erb
,
which gets inserted
where this is in application.html.erb
when you go to /more.