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
0
votes
1 answer

Good 404 in Rails, with search result on moved pages for new links

I am trying to replace lots of pages in my database at once, and lots of pages that are indexed by Google will have new URLs. So in result, old pages will be redirected to a 404 page. So I need to design a new 404 page, by including a search box in…
Victor
  • 13,010
  • 18
  • 83
  • 146
0
votes
1 answer

How to set Rails polymorphic model with friendly_id and history

I have a Company and Seo Model (in link below Seo called PublicSlug) with polymophic association and concern similiar to answer Match multiple models in single Rails route with friendly_id to build concern and all works as long as I add :history…
0
votes
1 answer

Friendly_id preventing edit/new pages due to before_action :find_post

I am using the friendly_id gem to handle URL Slugs and when applying a fix to avoid 404's when the slug changes from the documentation, my code doesn't work properly. The problem is that it simply redirects to the post's show view when I click on…
Jake
  • 1,086
  • 12
  • 38
0
votes
1 answer

How to fix FriendlyID duplicate content for :id and :slug

FriendlyID is consistently showing duplicate content for both /slug and /1. In other words, the correct page is loading for the friendly slug (/new-york), but it's loading the same content for the old, unfriendly slug (/11). Here's my current…
Antonio Fergesi
  • 151
  • 1
  • 9
0
votes
2 answers

Undefined 'id' when i use Friendly_id gem

I'm using the friendly_id gem for modifying my urls. But i have a problem with my likes system. For the use of friendly_id i change my controller: @software = Software.find(params[:id]) to @software = Software.friendly.find(params[:id]) So my…
Clyde T
  • 141
  • 10
0
votes
1 answer

RoR Simple Friendly Slugs

I'm currently using Friendly_ID to create friendly slugs of the form "/post/friendly-name". e.g., routes.rb reads: get '/posts/:id', to: 'posts#show' HOWEVER, I don't want the "/post" element: the public url should simply be "/friendly-name". For…
Antonio Fergesi
  • 151
  • 1
  • 9
0
votes
0 answers

Friendly_ID stops working at times, server restart necessary

I'm running a Rails 5.0.6 app with Friendly ID 5.2.4 and everything works fine except that after some time (sometimes a few hours, sometimes a few days) the friendly ids are not working anymore (instead of /username/slug-of-user-post it will become…
Cojones
  • 2,930
  • 4
  • 29
  • 41
0
votes
1 answer

subcategories and categories rails friendly_id

Cant seem to get friendly_id to work with with my categories and subcategories. I am using the friendly_id gem as well. Here is my categories controller class CategoriesController < ApplicationController def index @categories =…
Jame row
  • 1
  • 3
0
votes
2 answers

RoutingError on empty field, conflicting with friendly_id

I have a edit form for @users. In there I have a text_field :username <%= form_for @user, :url => { :action => "update" } do |f| %> <%= render 'shared/error_messages', :target => f.object %>
<%= f.label :username %>
Sebastian
  • 509
  • 1
  • 5
  • 14
0
votes
1 answer

Rails 5: FriendlyId TypeError (wrong argument type Symbol (expected Module:))

I am trying to add friendlyid to my application, after I've setup everything I get the following error: TypeError wrong argument type Symbol expected Module I inserted extend :FriendlyId and friendly_id :wine_name, use: :slugged into my model. I…
klasarn
  • 129
  • 1
  • 12
0
votes
1 answer

Rails validate uniqueness for the ASCII approximation

I hope the title is not too unclear. I am making arails app and I have a question about rails validation. Consider this code in the User,rb model file: validates :name, presence: true, length: { maximum: 50 }, …
Ilja KO
  • 1,272
  • 12
  • 26
0
votes
0 answers

Friendly_id slug_history is updating with wrong slug

When I create a new Invoice in my Rails program friendly_id is updating the history with the new slug. What do I need to do to fix this issue. Currently I have no idea how to fix this in my program. extend FriendlyId friendly_id…
Stefan
  • 61
  • 6
0
votes
0 answers

Rails - Multiple Models with root sluggable routes

I'm looking for advice to find the ideal solution that fits within Rails' best practises. My app has 5 models: Category Place Division Subdivision Item (polymorphic) A Place belongs to a Category. A Division belongs to a Place. A Subdivision…
0
votes
1 answer

How to find_by_id when using friendly_id (for polymorphic relations)

How do I allow find_by_id to work so my comments will work with my posts that have slugs via friendly_id? Is there an alternative approach to doing this? I have installed a Ruby gem called friendly_id and use it to create slugs on my blog posts.…
Jake
  • 1,086
  • 12
  • 38
0
votes
1 answer

Friendly_id Unique contraint with scope and history

'rails', '~> 5.1.2' 'friendly_id', '~> 5.1.0' I'm trying to add 'scoped' to my existing slugs. class Model < ApplicationRecord extend FriendlyId belongs_to :board friendly_id :slug_candidates, use: [:slugged, :scoped, :history],…
randomInput
  • 19
  • 1
  • 5