Questions tagged [friendly-id]

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.

The project on github

496 questions
1
vote
2 answers

How do I capture two routes for a URL generated by friendly_id?

I have setup friendly_id perfectly, and whereas my old URLs used to look like: /posts/1....now they look like: /posts/article-title-here. I was able to get rid of the posts in the URL altogether...so that it it just looks like: /article-title-here,…
marcamillion
  • 32,933
  • 55
  • 189
  • 380
1
vote
2 answers

Rails Friendly ID Custom Route

I'm trying to get my routes to work like this: /articles//
I'm using: ruby '2.1.2' gem 'rails', '4.1.4' gem "friendly_id", "~> 5.0.1" I have a category that has many articles the url structure now is:…
Pavan Katepalli
  • 2,372
  • 4
  • 29
  • 52
1
vote
2 answers

How do to show path with friendly_id?

Note that User has many Photos. I'm using the friendly_id gem to generate a slug for photos. This is my Photo model: class Photo < ActiveRecord::Base extend FriendlyId friendly_id :photo_by_author, :use => :slugged def…
Igor Martins
  • 2,015
  • 7
  • 36
  • 57
1
vote
4 answers

Friendly Id with UUID

I have project with Rails 4.1. I need to implement url something like this .../items/. I know I can make it manually, but I'm too lazy for it. Does everybody know how can I use friendly_id to get UUID for slug? Thanks for answers.
user3309314
  • 2,453
  • 2
  • 17
  • 30
1
vote
1 answer

Unable to change URL path after updating attributes with friendly_id

I've been following the Railscast tutorial on how to implement friendly_id and for some reason my URL's doesn't change after I update my attributes. Say I registered a user with :fullname 'John Doe' it creates the slug /john-doe successfully.…
user2755537
  • 151
  • 1
  • 9
1
vote
0 answers

Capture Parent Information Before Child Object Created

I am working with two models: Locations and Products Locations is the parent and products is the child. I previously had these records being created separately, first having the user create the Location and then the Product. I am now using…
RubyNewbie
  • 547
  • 5
  • 21
1
vote
1 answer

Disable friendly_id on specific action

I'm using the friendly_id gem (Rails 3.2) and I want a specific action (edit) to not use the friendly id slug. How can i do this? Example: for show action: "site.com/object/friendly_id" for edit action: "site.com/object/id/edit" Is this possible?…
Uri Klar
  • 3,800
  • 3
  • 37
  • 75
1
vote
1 answer

friendly_id_slugs Table

Working on another deployment & found that rails generate friendly_id (as recommended by the Friendly_Id Documentation creates a new table called friendly_id_slugs - is this right or legacy?
Richard Peck
  • 76,116
  • 9
  • 93
  • 147
1
vote
1 answer

Duplicate routes / metatags from Friendly_id

Google just let me know that I have duplicate meta tags. This is coming because I have duplicate routes from setting friendly_id /posts/2 /posts/awesome-post-about-ponys How do I make the first one invisible to google/the DMZ?
ajbraus
  • 2,909
  • 3
  • 31
  • 45
1
vote
3 answers

How to turn blog title into a link on the index page in rails 4 using Friendly ID gem

I'm still very much a novice and can't figure out how to get my blog titles to link to the full post. I'm using the friendly id gem and built this basic blog following the Getting started instructions at…
Kevin Dark
  • 2,139
  • 5
  • 22
  • 23
1
vote
1 answer

Pass Validation on Form Fields Before Friendly ID Creation - Custom

I currently have two models Location and Product I have it configured that when a record is created in my production model, it creates a custom url based on the information it has gather from the location selected during the product creation extend…
RubyNewbie
  • 547
  • 5
  • 21
1
vote
1 answer

Friendly_Id 5.0 -> RecordNotFound

In my model I have the following: class Dyno < ActiveRecord::Base include FriendlyId friendly_id :slug_candidates, :use => [:slugged, :history, :finders] def should_generate_new_friendly_id? car.present? && horsepower_changed? end …
Joel Grannas
  • 2,016
  • 2
  • 24
  • 46
1
vote
1 answer

friendly_id scope unique to parent resource

Is it possible to scope the slug to the parent resource so that two users can share the same resource slug? example: two users would have news articles "i-am-awesome" domain/joe/news/i-am-awesome domain/sara/news/i-am-awesome I've made a custom…
ethayer
  • 55
  • 1
  • 6
1
vote
1 answer

Friendly_Id: id is slug, but url still displays object id attribute (?id=)

I'm trying to implement the Friendly_Id gem in my rails 4 app and have hit a roadblock. The gem is working, but the url still isn't pretty. It looks like this: http://www.example.com/project/featured?id=project-name The gem is working because the id…
1
vote
0 answers

Acts_as_taggable_on and friendly_id in ruby on rails

I have 2 tagging systems that belong to a question model - Topics and Place They are both working, however I have a problem as a place can be more then 1 word e.g New York So the current URL is /places/New%20York I want it to be /places/New-York I…