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

Friendly_Id record not found

I get a record not found exception using friendly_id 5.0 stable with Rails 4.0 Error: Migration: class AddSlugToUsers < ActiveRecord::Migration def change add_column :users, :slug, :string add_index :users, :slug …
DogEatDog
  • 2,899
  • 2
  • 36
  • 65
0
votes
3 answers

Eager loading belongs_to relationship in rails

My rails 4 application has many Measures which belong to a Station. I tried to eager load the measures in my controller: @station = Station.includes(:measures).friendly.find(params[:id]) @measures = @station.measures However when I added a method…
max
  • 96,212
  • 14
  • 104
  • 165
0
votes
1 answer

Rails ActiveSupport NoMethodError from unicode.rb

In my rails 3.2.15 project I'm getting inconsistent failures in my specs coming from active_support/multibyte/unicode.rb. Sometimes the specs fail, sometimes they pass. I haven't seen it outside of the tests, though. It's in the same particular area…
lobati
  • 9,284
  • 5
  • 40
  • 61
0
votes
1 answer

How do I find associated records for a record found by slug with Friendly ID?

I have implemented Friendly IDs and right now I am having trouble associating the opportunities for a company by slug (I had this working fine by ID). CompaniesController: def show @opportunities = Opportunity.where("company_id = ?",…
user2384124
0
votes
1 answer

CanCan Resource Conditions and special routing with friendly_id slugs

I have a Page Model that has a :name attribute. I have a specific route for the Page Model with the name "home", because I want this specific Page record to be found at the root_url. This works.. but because I'm hard coding the route... I only want…
0
votes
2 answers

"Key (slug)=() already exists" in friendly_id on rails4 app

While I'm trying to setup friendly_id to my rails4 project, similarly, I got error after I add "friend" after "friend" to friends table. How can I fix it: PG::UniqueViolation - ERROR: duplicate key value violates unique constraint…
ekremkaraca
  • 1,453
  • 2
  • 18
  • 37
0
votes
1 answer

Ruby on Rails: dynamic multi-path to one page

In Rails 4, I have 3 models class Tag < ActiveRecord::Base # attr_accessible :id, :name end class Category < ActiveRecord::Base # attr_accessible :id, :name end class Product < ActiveRecord::Base # attr_accessible :id, :name belongs_to…
yeuem1vannam
  • 957
  • 1
  • 7
  • 15
0
votes
1 answer

friendly-id, checking two models/tables for existing slugs

Imagine the following route: get ':slug/:location' where :search is triggering a finder on two different models (ie. Businnes, Person) based on the slug provided. The problem I'm currently facing is that I couldn't find a way to check two…
Grzegorz Kazulak
  • 424
  • 3
  • 7
  • 12
0
votes
1 answer

Friendly id, Friendly is reserved

Um - Most confusing validation error ever, considering I am not even using the word Friendly how ever my model for roles looks like this: class Role < ActiveRecord::Base validates :role, presence: true extend FriendlyId friendly_id :role,…
Adam
  • 609
  • 2
  • 8
  • 15
0
votes
1 answer

Friendly_Id with 2 or more models

i'm trying to use (Friendly_Id 5.0.0.Beta4) in (Rails 4) with 2 models but just work with one. I have this models: class Author < ActiveRecord::Base has_many :articles extend FriendlyId friendly_id :name, use: :slugged end class Category <…
mijailr
  • 71
  • 1
  • 12
0
votes
1 answer

Rails override nested friendly_id in update action

I'm using the friendly_id gem to handle slugs in my Rails 4 app. For simplicity's sake, let's say I have two resources, Missions and Tasks. Tasks are nested inside Missions. Both models are using FriendlyId, and the slugs are working fine. …
Tyler
  • 829
  • 11
  • 26
0
votes
2 answers

Friendly_id | Active Record not found

I follow the Railscast Episode Pretty URLs with FriendlyId. I'm on Rails4 and using the 5.0 stable branch on Friendly Id's Github Repo. I followed the Tutorial: My Model Clip.rb: extend FriendlyId friendly_id :title, use: :slugged My…
Mini John
  • 7,855
  • 9
  • 59
  • 108
0
votes
1 answer

Rails routes remove characters from URL

I have URLs like this arizona/AZ12 colorado/CO470 I added the AZ and CO because friendly id wanted unique ids. Arizona and Colorado could have a unit 12. I'd like to have URLs like arizona/unit12 colorado/unit470 Seems like you could write…
0
votes
1 answer

Rails friendly_id gem mass assignment issue

I am using "friendly_id 4.0.0" gem for making url user friendly. below is my user model user.rb model class User < ActiveRecord::Base extend FriendlyId friendly_id :name , :use => [:slugged,:history] attr_accessible :email, :lname, :name …
user2534381
  • 215
  • 1
  • 3
  • 9
0
votes
1 answer

Rails 3.2: Devise signup breaks when name or email not unique or email is fake (FriendlyID)

Edit: thanks @vinodadhikary -- upon further investigation it seems that the error happens when a) the email is not unique, b) the name is not unique or c) the email is obviously fake (h@h.com). If Devise isn't going to accept a signup I would prefer…