Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

« Newer Snippets
Older Snippets »
Showing 1-4 of 4 total  RSS 

create new rails rake task

Create new task for /unit/helpers/*_test.rb

Rakefile
namespace :test do
  Rake::TestTask.new(:helpers) do |t|
    t.libs << "test"
    t.pattern = 'test/unit/helper/*_test.rb'
    t.verbose = true
  end

  Rake::Task['test:helpers'].invoke
end

Ruby On Rails With Apache and mod_proxy using .htaccess

If you want your rails app in the same apache html directory, use a .htaccess like this :

RewriteEngine   on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule     (.*) http://localhost:3000/$1 [P]


All resources that don't exist in your html directory will be requested ( using proxy) from mongrel.

Truncate

// Truncate text in ruby on rails views

<%= truncate(events.name, 50) %>

ROR (rotate-right) function

    ROR: func ["Rotate Right" s [series!] n [integer!]][
        n: n // length? s
        append copy at s ((length? s) - (n - 1)) copy/part s (length? s) - n
    ]
« Newer Snippets
Older Snippets »
Showing 1-4 of 4 total  RSS