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
0
votes
1 answer
How do I let an AR validation happen before a module extension on my model?
I am using FriendlyID, and it creates a slug based on some attributes of a record upon creation.
extend FriendlyId
friendly_id :name_and_school, use: :slugged
def name_and_school
"#{first_name} #{last_name} #{school.name}"
end
I also…

marcamillion
- 32,933
- 55
- 189
- 380
0
votes
1 answer
Trying to generate friendly_id on rails 5
I keep getting this msg
$ rails generate friendly_id
Running via Spring preloader in process 17863 Could not find generator
'friendly_id'. Maybe you meant 'channel', 'generator' or 'helper' Run
rails generate --help for more…

KingD
- 1
- 2
0
votes
1 answer
FriendlyId doesn't update slug on title changed
I am building a Rails application using ActiveAdmin, Globalize and FriendlyId.
In my model I settled up the Globalize and FriendlyId parameters (extract):
class Post < ActiveRecord::Base
translates :title, :slug, :content
active_admin_translates…

anthony
- 640
- 1
- 10
- 32
0
votes
2 answers
Rails active record::not found using friendly id and slug recognition
ive set up my rails app to use friendly_id and paperclip and i've added the slug column to the 'designs' database table using a migration. When I create a new design post and upload my image (using paperclip) the slug column is not updated when I…

sdawes
- 631
- 1
- 7
- 15
0
votes
1 answer
Why user/name/post/name address is the same (fiendly_id)
I am using friendly_id and I want to make each user's post page address friendly.
For example
user/name/post/name
user/name is not duplicated, but post/name can be duplicated.
I thought if I use user/name/post/name then the pages are different but…

suusmu
- 1
0
votes
1 answer
"undefined method `slug'" when trying to save nested route using Friendly_id 5
My App allows a user to create an Event and people can RSVP to the event. The app worked well before adding the Friendly_id gem, it works well as far as creating a new Event, but the RSVPs do not work as when you click submit you get an error.…

Morez SA
- 87
- 7
0
votes
1 answer
authlogic require user
I use authlogic for authentication and certain actions require a logged in user, which is controlled via a before_filter like the following. I also use friendly_id on the User model and internally everything there is a look up on the User model…

badnaam
- 1,876
- 4
- 29
- 53
0
votes
1 answer
Ruby on Rails - Remove slug uniqueness from Friendly_id slug in database
I use Friendly_id gem in my application. In my Slide model, I don't need slug to be unique, as it's never duplicated (it's auto generated)
How can I remove sluguniqueness from my slides database.
This is what I have: index_slides_on_slug_and_post_id…

Rubioli
- 685
- 6
- 34
0
votes
2 answers
Rails generate short route
Hi :) I have a question I'm not really sure how to fix or solve the specific problem.
I am using MongoDB .
I would like to make my route small to share it to the public.
For example…

BilalReffas
- 8,132
- 4
- 50
- 71
0
votes
1 answer
rails friendly_id bad request
I'm new to rails and currently involved in an internship and I was assigned to use the friendly_id gem for my tournament class, this is part of the code in it:
class Tournament < ApplicationRecord
extend FriendlyId
friendly_id :url_id
…

Robert
- 178
- 1
- 8
0
votes
1 answer
How to remove controller name from url using friendly_id
I have installed and used friendly_id to remove the blog id out of my url, and replaced it with the blog title. However, I also need to remove the controller name out of the url:
currently: appname/blogs/one-of-the-blog-posts
what I would like:…

halfacreyum
- 297
- 5
- 16
0
votes
2 answers
How would you avoid having to use User.find_by_id(id) || User.find_by_slug(id)
The idea behind Friendly_ID is that you can use a slug or id to retrieve a record.
So User.friendly.find(id) will retrieve a record using either the slug or id. If the record isn't found, it raises an error.
I want to find the record but return nil…

gitb
- 1,090
- 2
- 12
- 20
0
votes
1 answer
Trying to copy what friendly_id does to turn a strong into a slug
I need to copy the way friendly_id changes text into slugs.
I was using this for my app
text = "random text"
text_gsubed = (value.gsub ' ', '-')
slug = text_gsubed.downcase
But recently I realised for text with non alphabetic or…

Rob
- 1,835
- 2
- 25
- 53
0
votes
2 answers
Invoking Rake::Task in rails causes "Don't know how to build task..."
Trying to integrate some friendly_id gem functionality on a controller method.
Essentially, I have a Market object, which has its URL created based on a custom method. Since it's based on a custom method, friendly_id won't update the URL when the…

Kevin Whitaker
- 12,435
- 12
- 51
- 89
0
votes
1 answer
Attaching conditional methods(or attributes?) to a rails model
I'm using the friendly_id plugin to generate SEO-friendly URLS for some of my models.
Currently, I have a model with two attributes: name and display_name.
Essentially, display_name is preferred, but if it is blank, the model reverts to name. …

Kevin Whitaker
- 12,435
- 12
- 51
- 89