Your given example is working very well
class Ask
def self.make_permalink(phrase)
phrase.strip.downcase.gsub! /\ +/, '-'
end
end
Ask.make_permalink("make a slug out of this line")
I tried in 1.8.7 and also in 1.9.3
Do you have a typo in you original script?
All the best
Related Contents:
- How to “pretty” format JSON output in Ruby on Rails
- How can I specify a local gem in my Gemfile?
- What is the difference between
- @ variables in Ruby on Rails
- OO Design in Rails: Where to put stuff
- Rails: Is there a rails trick to adding commas to large numbers?
- Ruby / Rails: convert int to time OR get time from integer?
- ‘sudo gem install’ or ‘gem install’ and gem locations
- A copy of xxx has been removed from the module tree but is still active
- Trouble comparing time with RSpec
- Convert Time from one time zone to another in Rails
- Purpose of “consider_all_requests_local” in config/environments/development.rb?
- Bundler: can’t find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException) during bundle install with gem
- Speeding up RSpec tests in a large Rails application
- Hash remove all except specific keys
- How does load differ from require in Ruby?
- What exactly is Arel in Rails 3.0?
- Best Solution For Authentication in Ruby on Rails [closed]
- Format the date using Ruby on Rails
- PG::Error: SELECT DISTINCT, ORDER BY expressions must appear in select list
- How to monitor delayed_job with monit
- nokogiri gem installation error
- How to get a query string from a URL in Rails
- Why is rake db:migrate:reset not listed in rake -T?
- Controller spec unknown keyword: id
- Rails: How to make Date strftime aware of the default locale?
- How do I use CSS with a ruby on rails application?
- How to obtain first day of next month in ruby?
- database configuration does not specify adapter
- Rails 3: yield/content_for with some default value?
- Resize existing images to new style in paperclip & RMagick
- ‘-%>’ (minus sign) at the end of a ERb sequence
- TypeError: no implicit conversion of Symbol into Integer
- RSpec any_instance deprecation: how to fix it?
- Rails Migration: How to increase column data type size by using ROR migration
- What’s the difference between “includes” and “preload” in an ActiveRecord query?
- Rails 3 – no such file to load — openssl
- Rails: respond_to JSON and HTML
- Ruby find and return objects in an array based on an attribute
- Bundler cannot install any gems without sudo
- How to convert a Ruby object to JSON
- How do I find the source file for a rake task?
- Ruby on Rails app on Google App Engine
- Rails Browser Detection Methods
- Force strings to UTF-8 from any encoding
- Ruby – Merge two arrays and remove values that have duplicate
- How do I create a ruby Hello world?
- What is ‘$:.unshift File.dirname(__FILE__)’ doing?
- ActiveRecord find starts with
- In Rails 4.1, how to find records by enum symbol?