FriendlyId is the "Swiss Army bulldozer" of slugging and permalink plugins for Ruby on Rails. It allows you to create pretty URL's and work with human-friendly strings as if they were numeric ids for Active Record models.
Questions tagged [friendly-id]
496 questions
26
votes
3 answers
Rails 4 Friendly Id Slug Not Updating
I'm using the following:
gem 'friendly_id', github: 'FriendlyId/friendly_id', branch: 'master'
I am creating an Article section on my Rails 4 website. The problem I am having is that when I change a existing article's name the slug is not…

Brian
- 5,951
- 14
- 53
- 77
16
votes
5 answers
ActiveRecord::ReadOnlyRecord when using ActiveAdmin and Friendly_id
I started using ActiveAdmin recently in a project and almost everything works great but I'm having a problem when using it in combination with the friendly_id gem. I'm getting ActiveRecord::ReadOnlyRecord thrown for my forms [i believe] because of…

holden
- 13,471
- 22
- 98
- 160
15
votes
2 answers
undefined method `synchronize' for nil:NilClass
I just created a new app from scratch on rails4.0.0.rc1 with 1.9.3-p374 (which should work according to the guides).
However, I fail doing a simple create-action.
class Books
def create
@book = Book.new book_params
if @book.save
…

pdu
- 10,295
- 4
- 58
- 95
11
votes
1 answer
Generating a unique URL with tokens in Rails 4 for an external form response
I have a 'Feedback' model whereby a user should be able to request feedback on his/her job performance. I have written basic actions for creating a new feedback request, and the mailer for sending the request to the provider (person who will respond…

turkeyman84
- 165
- 1
- 9
10
votes
3 answers
friendly_id slug not changing on update
I'm using friendly_id 5.0.0.rc1, and also active_admin.
It would appear everything is working perfectly as expected, except for the fact that updating a record's slug attribute/column in active_admin does not do anything (it keeps it the same)
I…

Tallboy
- 12,847
- 13
- 82
- 173
9
votes
3 answers
Friendly ID - undefined method `slug=' for
I am using the gems Workflow, Paper Trail and Friend ID.
To track the state changes using Paper Trail, I have overridden the persist_workflow_state to explicitly update the workflow column, so that Paper Trail can capture the…

Geordee Naliyath
- 1,799
- 17
- 28
9
votes
2 answers
Rails: Friendly_id does not generate slugs for old records
I've used the FriendlyId gem (version 4.0.8) with a Rails application. I've followed the tutorial on RailsCasts and based on the documentation, I have to run Model.find_each(&:save) on rails console to generate slugs for old records. However, when I…

gerky
- 6,267
- 11
- 55
- 82
8
votes
5 answers
Rails4 Friendly_id Unique Slug Formatting
I am using friendly_id gem for slugging my models. Since the slug has to be unique when i enter the same data to check i get a long hashed appending in the slug.
Explore explore
Explore explore-7a8411ac-5af5-41a3-ab08-d32387679f2b
Is there…

Harsha M V
- 54,075
- 125
- 354
- 529
8
votes
2 answers
Rails Friendly Id - Couldn't find Category with id=electronics
I'm trying to develop a app in Ruby on Rails 4.0 (already used older versions of this incredible framework) and I having some troubles.
I installed the FriendlyID gem and I think everything is okay, but I'm receiving errors when I try to test my…

Paladini
- 4,522
- 15
- 53
- 96
7
votes
1 answer
Redirect same page to different language with Globalize & Friendly_id
I've been scratching my head for the last few hours, looking for an answer but I can't find it anywhere.
My gem file:
# Use globalize for translating models
gem "globalize", github: "ncri/globalize" # for Rails 4.2
gem 'globalize-accessors', '~>…

Vincent
- 147
- 10
7
votes
2 answers
Change the unique generated title names of friendly-id
I am using the friendly_id gem. In the portfolio.rb I placed these two lines:
extend FriendlyId
friendly_id :title, use: :slugged
As you can see I am also using the slug option. When I create a project with title "example" it works find and I…
user2911232
7
votes
2 answers
User editable slugs with Friendly ID
Case:
My station forms contain a slug field, if a value is entered it should be used as the slug.
EDIT: some clarification:
What I want is much like how slugs work in wordpress:
If no slug is provided -> slug the name
If slug is provided ->…

max
- 96,212
- 14
- 104
- 165
7
votes
1 answer
Friendly_id not creating slugs for old records
I just added the Friendly_id gem to my rails project looking to not use the database id and create a slug, but I can't seem to create slugs for old records. My model looks like this.
class Mapping < ActiveRecord::Base
extend FriendlyId
…

rigelstpierre
- 534
- 1
- 6
- 22
6
votes
5 answers
friendly id and devise error when using reserved word
I used friendly id to allow user access profile with their login name, but when I try to sign up with login name that has been reserved by the friendly Id, I got an error. It seems devise can't render the error message properly. The error just works…

Iqbal
- 246
- 2
- 10
6
votes
4 answers
rails friendly_id and check if entry exists
How to check if friendly_id entry exists before get it?
For example:
def book
@book = Book.find(params[:book_id])
end
It's ok, but i want check before if friendly_id exists, something like:
def book
if Book.exists?(params[:book_id])
…

KK2
- 63
- 1
- 3