# Friendly\_id and Rake problem

**URL:** <https://www.ruby-forum.com/t/friendly-id-and-rake-problem/176699>\
**Category:** Rails\
**Created:** [October 5, 2009, 3:24am UTC](https://www.ruby-forum.com/t/friendly-id-and-rake-problem/176699 "2009-10-05T03:24:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [October 5, 2009, 3:24am UTC](https://www.ruby-forum.com/t/friendly-id-and-rake-problem/176699/1 "2009-10-05T03:24:15Z")

</div>

Hello there,

The plugin friendly\_id ([GitHub - norman/friendly\_id: FriendlyId is the “Swiss Army bulldozer” of slugging and permalink plugins for ActiveRecord. It allows you to create pretty URL’s and work with human-friendly strings as if they were numeric ids for ActiveRecord models.](http://github.com/norman/friendly_id)) has rake  
tasks that you can call.

I’m using this plugin as a gem.

I’m trying this: rake friendly\_id:make\_slugs MODEL=Post  
and it is rising this error: Don’t know how to build task  
‘friendly\_id:make\_slugs’

So the question is: how do I call a gem’s rake task?

David S.

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [October 5, 2009, 1:40pm UTC](https://www.ruby-forum.com/t/friendly-id-and-rake-problem/176699/2 "2009-10-05T13:40:10Z")

</div>

Taken directly from the README.rdoc that is part of the installed  
package:

sudo gem install friendly\_id  
cd my\_app  
script/generate friendly\_id  
rake db:migrate

Here’s how to see the documentation for installed gems on your system.

1. create an executable file named “gem\_server.rb” that contains

#!/usr/bin/env ruby

require ‘rubygems/server’

gem\_server = Gem::Server.new Gem.dir, 8089, false  
puts gem\_server.inspect  
gem\_server.run

1. run: gem\_server.rb &

2. browse to: localhost:8089

On Oct 4, 9:24 pm, David S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [October 5, 2009, 2:18pm UTC](https://www.ruby-forum.com/t/friendly-id-and-rake-problem/176699/3 "2009-10-05T14:18:52Z")

</div>

Hi Rick,

thanks for the replay, but you did not understand my problem.  
I’ll try to be more clear now.

I’m using friendly\_id as a GEM, and it is working perfectly.  
Because my application already has some data, I would like to generate  
slugs for the post that have been created already. So that is why I  
wanna to execute that rake task.

I can see that the rake task is defined at lib/tasks/friendly\_id.rake,  
but how do I call that rake task in my application?

Any way thanks for the hint, I did not know how to browser the already  
installed gems’ documentation.

David S.

Rick Lloyd wrote:

> Taken directly from the README.rdoc that is part of the installed  
> package:
> 
> sudo gem install friendly\_id  
> cd my\_app  
> script/generate friendly\_id  
> rake db:migrate

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [October 5, 2009, 6:59pm UTC](https://www.ruby-forum.com/t/friendly-id-and-rake-problem/176699/4 "2009-10-05T18:59:48Z")

</div>

I was looking into this ticket (  
[#59 When loading a plugin via rubygems, rake tasks aren't included - Ruby on Rails - rails](https://rails.lighthouseapp.com/projects/8994/tickets/59) ) and found out  
that this is a problem that every gem faces.

If someone knows a stable solution, pleas contact me.

Thanks.

David S.

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [October 5, 2009, 2:38pm UTC](https://www.ruby-forum.com/t/friendly-id-and-rake-problem/176699/5 "2009-10-05T14:38:47Z")

</div>

Rick Lloyd wrote:  
[…]

> Here’s how to see the documentation for installed gems on your system.
> 
> 1. create an executable file named “gem\_server.rb” that contains
> 
> #!/usr/bin/env ruby
> 
> require ‘rubygems/server’
> 
> gem\_server = Gem::Server.new Gem.dir, 8089, false  
> puts gem\_server.inspect  
> gem\_server.run
> 
> 1. run: gem\_server.rb &
> 
> 2. browse to: localhost:8089

Why go to all that trouble? Much simpler to just type “gem server” at a  
command prompt (if you do that, the default port is 8808). I don’t see  
any advantage in your method…am I missing something?

> On Oct 4, 9:24ï¿½pm, David S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid
