ruby

Tags:  •    •    •    •  

Today, I found a really good CMS. I'm looking for ruby 3 CMS for a while. I found this CMS solution that use my favorite NoSQL database system: MongoDB. I think multi site feature is rare in ror applications. Locomotive CMS do it.

Locomotive is an open source CMS for Rails 3. It's super flexible and integrates with Heroku and Amazon

Some features from technical Specs:

Tags:  •    •    •  

The problem

I want to write JavaScript files that use dynamic informations via Ruby on Rails. I think my solution also works with rails 2 and 3.
What can dynamic JavaScript do for you? You can write JavaScript on your ERB (embedded ruby) file beside HTML code. This is very simple, but not the best solution for a longer jQuery script.
For example:
Translation in JavaScript: translation with I18n.t() Rails method would be great in separated JavaScript file with ERB capability.

// some jquery code before alert
alert(<%= I18n.t(:forbidden_message) %>);
Tags:  •    •    •    •    •  

Here is an example, what show the way you can translate your mongoid models:
You can also customize error messages as you will see in the next example.

User model translation Example:
en.yml content:

en:
  mongoid:
    errors:
      models:
        user:
          attributes:
            email:
              blank: "You have to give me your e-mail address"
              not_found: "e-mail address not found in list of members"
              #...
    attributes:
      user:
        email: "Email address"
        name: "Your nickname"
        #...
Tags:  •    •    •  

I got the following error when i run a rake db:seed command on may RoR application:
invalid multibyte char (US-ASCII)

I found the soution and the error has gone away:
You should add a line to your file:

# encoding: utf-8

You can change the utf-8 to any other encoding that you use.
I added this line to my seeds.rb file and all UTF-8 code have been executed without errors.

Good luck!

Tags:  •    •    •    •  

I've collected all open source CMS based on rails 3.x.

Rails CMS/Wiki/Forum

This is a very simple but feature rich CMS framework. It is good startpoint for a new rails project what will be wiki, Forum or CMS

Source: https://github.com/jlapier/Rails-CMS-Wiki-Forum

Casein CMS

This is a very minimal and lightweight CMS. Only users table created on rak db:migrate. It is a good start point for any content based application. This application scaffolding your rails app with a very beauty user interface.

Tags:  •    •    •    •  

Make config.ru with following content:

require 'rubygems'
require 'sinatra'
require './my_sinatra_application.rb'
 
run Sinatra::Application

You have to run bundle command. This will be install all necessary gems that listed in Gemfile.

You find debug log in default apache 2 error log files. This is /var/log/apache2/error.log in my case.

Tags:  •    •    •    •  

This small tutorial work on Ubuntu Hardy (8.04), Lucid 10.04 and Maverick (10.10)

Install Imagemagick and GraphicsMagick

apt-get install imagemagick graphicsmagick

Install Image Magick development files

apt-get install libmagickcore-dev libmagickwand-dev
gem install rmagick

On Hardy:
Install imagemagick from source and after it install development files:

sudo apt-get install libmagick9-dev
Tags:  •  

Padrino is a ruby framework built upon the excellent Sinatra Microframework.

$ padrino g project blog -d mongomapper -t rspec -s jquery -e haml -c compass
      create  
      create  config.ru
      create  public/favicon.ico
      create  config/apps.rb
      create  config/boot.rb
      create  app
      create  app/app.rb
      create  app/controllers
      create  app/helpers
      create  .components
      create  Gemfile
Applying 'mongomapper' (orm)...
       apply  orms/mongomapper
      inject  Gemfile
Tags:  •    •    •    •    •    •  

There are some easy steps to install Phusion Passenger for ruby 1.9.2 and apache2 on Ubuntu Linux.

1. Install rvm system wide

sudo bash < <( curl -L http://bit.ly/rvm-install-system-wide )

2. Install ruby 1.9.2

rvm install 1.9.2

3. add new line in /etc/bash.bashrc

[[ -s /usr/local/lib/rvm ]] && . /usr/local/lib/rvm

4. install passenger

sudo -i # you need root shell
rvm use 1.9.2-p0@global # or your version, use: rvm list