friendly-id

Implementing /YYYY/MM/Title-Slug URL structure with Friendly_Id

杀马特。学长 韩版系。学妹 提交于 2019-12-02 15:21:25
问题 I'm really hoping someone can help this Rails n00b with this issue. I've been researching, trying, crashing(-and-burning) over the past few days on how to implement the standard /YYYY/MM/Title-Slug URL structure for a blog I'm putting together. I've discovered and successfully implemented Friendly_Id to handle the sluggification (along with history tracking), but for the life of me I can't get the Year/Month part of the routing problem resolved. Before I forget: I'm using Rails 4.2.3 and Ruby

Rails Friendly_Id on Heroku, Heroku not updating slugs

丶灬走出姿态 提交于 2019-12-01 20:36:00
I've set up the friendly_id gem, following along to the RailsCasts Screencast on it. Locally this works brilliantly, I installed it, ran through User.find_each(&:save) which successfully updated the slug field on each of the existing users and all was fine. I have now pushed this to Heroku, and although it works fine for any new members that are added, Heroku isn't updating the user slug for me for already existing Users. Running heroku run console and then User.find_each(&:save) just does nothing: irb(main):001:0> User.find_each(&:save) User Load (20.2ms) SELECT "users".* FROM "users" WHERE (

Rails friendly id with non-Latin characters

邮差的信 提交于 2019-12-01 09:15:58
I have a model which I use its friendly id as slug: extend FriendlyId friendly_id :slug_candidates, :use => :scoped, :scope => :account def slug_candidates :title_and_sequence end def title_and_sequence slug = normalize_friendly_id(title) : # some login to add sequence in case of collision : end My problem is that when I use non-Latin chars (Arab, Hebrew,...) I get an empty slug. Is there any nice-and-easy solution? UPDATE Just to make my question clear, I would like to have the same behaviour as WordPress, which means: +--------------------+----------------------------------------------------

Rails friendly id with non-Latin characters

只谈情不闲聊 提交于 2019-12-01 06:57:14
问题 I have a model which I use its friendly id as slug: extend FriendlyId friendly_id :slug_candidates, :use => :scoped, :scope => :account def slug_candidates :title_and_sequence end def title_and_sequence slug = normalize_friendly_id(title) : # some login to add sequence in case of collision : end My problem is that when I use non-Latin chars (Arab, Hebrew,...) I get an empty slug. Is there any nice-and-easy solution? UPDATE Just to make my question clear, I would like to have the same

FriendlyID Korean slugs

北慕城南 提交于 2019-11-30 07:32:58
When I add article in Korean language with title e.g.: 신품 FriendlyID gem creates blank slug and url is like /8 ... so this is ID. Look at this link: http://www.srecipe.kr.com/articles/8 Other languages work. How can I get url which is mapped to latin letters like /this-is-url from 신품 ? Like all of these permalink solutions, friendly ID uses the parameterize method to convert a string into a URL safe string. like so: require 'active_support/all' puts "Oh Hai There".parameterize => oh-hai-there The problem comes in when you use non ASCII strings, which parameterize replaces with an empty string,

ActiveRecord::ReadOnlyRecord when using ActiveAdmin and Friendly_id

北城余情 提交于 2019-11-27 01:22:06
问题 I started using ActiveAdmin recently in a project and almost everything works great but I'm having a problem when using it in combination with the friendly_id gem. I'm getting ActiveRecord::ReadOnlyRecord thrown for my forms [i believe] because of the friendly_id attribute whose ID is readonly: {"utf8"=>"✓", "_method"=>"put", "authenticity_token"=>"Rc5PmUYZt3BiLvfPQr8iCPPXlbfgjoe/n+NhCwXazNs=", "space"=>{"name"=>"The Kosmonaut", "address"=>"8 Sichovykh Striltsiv 24", "email"=>"info