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
2 answers

How do I send a two chained methods as a symbol?

In order to properly search my Posts using friendly_id, I use this query : Post.friendly.find(params[:id]) But I need to wrap this method up and send it to my presenter class gem, decent_exposure. Which gives me a fancy place to include a method…
Trip
  • 26,756
  • 46
  • 158
  • 277
0
votes
1 answer

User path with username

To show User's profile I used their id. In controller: @user = User.find(params[:id]) In routes: get ':id' => 'users#show' But now I try new way with username: get ':username' => 'users#show' #route @user = User.find_by(username:…
0
votes
1 answer

Change the unique generated title names of friendly-id using attribute of another table

I have a Company Model, and i am using friendly_id like this friendly_id :name, use: :slugged But since there can be many Company with the same name (different branches). I am trying to handle that case by using city attribute from the address of…
Alfie
  • 2,706
  • 1
  • 14
  • 28
0
votes
2 answers

how do I blacklist users slugs with friendly id?

I want to use friendly id so that users can have a nice url. However I want to blacklist certain names such as api or admin or curse words. Where do I load the yaml file to do that? in the model?
caffeinescript
  • 1,365
  • 2
  • 13
  • 27
0
votes
2 answers

How to include id in slug using friendly_id

I am using friendly_id gem to have pretty urls in my application.I want an url like: localhost:3000/posts/1/my-first-post I want to do it using the friendly_id gem as i want to use the History module to avoid 404 error.I have tried but can't…
ananyo2012
  • 63
  • 9
0
votes
1 answer

Data migrations for older version of friendly id

I'm migrating a very old app from friendly_id 3.2 to 5.1. I have a user model which currently has a cached_slug field. I created a new field called just slug. Initially, I thought I could just copy the data over from cached_slug to slug, but I…
Jeff
  • 1,051
  • 1
  • 13
  • 26
0
votes
1 answer

searching belongs_to association via friendly_id slug

An appointment belongs to a schedule. Without using friendly_id, the following code works, as expected, to build a list of appointments: def show @appointments = Appointment.where(schedule_id: params[:id]) end However, when I send the slug…
Hoffa
  • 197
  • 1
  • 1
  • 12
0
votes
0 answers

ActiveModel::ForbiddenAttributesError with Friendly_id

I am getting the ActiveModel::ForbiddenAttributesError with friendly_id and for the life of me cannot work out why. I believe I have configured my strong params as per normal and even tried modifying them multiple times to see what would happen.. I…
bnussey
  • 1,894
  • 1
  • 19
  • 34
0
votes
2 answers

When I try to edit a record which use friendly_id, it gives me a no route match error

I am using friendly_id for my Product model. Here's my routes : resources :products, only: :show scope '/dash' do resources :products end Now when I go to the edit action, I used friendly ID to load the correct form. The edit form loads…
THpubs
  • 7,804
  • 16
  • 68
  • 143
0
votes
1 answer

rspec shoulda matchers with friendly id custom slug not working

I have a model with custom slug with friendly id: # == Schema Information # # Table name: blogs # # id :integer not null, primary key # title :string not null # content :text not…
Aravind
  • 1,391
  • 1
  • 16
  • 41
0
votes
1 answer

Friendly with existing Rails 4 app: No change

I have an existing app with devise running. User and log in and out etc. Thought I would like to get localhost:3000/users/15 changed to localhost:3000/users/ruby-boy so I have installed https://github.com/norman/friendly_id I have ran rails generate…
Sylar
  • 11,422
  • 25
  • 93
  • 166
0
votes
2 answers

Having a duplicate number sequence in slug using FriendlyId

I'm using the gem 'friendly_id', '~> 5.0.0 and I just want to use the old behaviour which is appending a number sequence count in the slug instead of UUID. for example >> test-slug-2 >> test-slug-3 >> test-slug-4 I was able to make this…
AllenC
  • 2,754
  • 1
  • 41
  • 74
0
votes
0 answers

My Rails 4 create action is being thwarted by FriendlyId

I'm working on a simple app that lets a User make a Donation to a Project. My Project model uses FriendlyId. It's all going well. Users can create projects, etc. But I can't seem to get the Donations controller to resolve the project id. Here's my…
Dennis Best
  • 3,614
  • 3
  • 20
  • 31
0
votes
1 answer

Using @ with friendly_id rails

I want to use '@' before the link in friendly_id I have username and I am saving username in database with '@' symbol. Its working correctly. But Friendly_id is showing example.com/username and I want example.com/@username How can I do that ?
Adt
  • 495
  • 6
  • 19
0
votes
2 answers

NoMethodError at / undefined method `name' for nil:NilClass

I have tried many solution and came up with good one but still getting error. I am editing my whole question. I am trying to create Friendly URL with friendly_id gem. In my project First user need to signup with devise. Devise will pass some…
Adt
  • 495
  • 6
  • 19