friendly-id

    0熱度

    2回答

    我只是添加friendly_id來美化我的網址。 我得到一個錯誤 Couldn't find User with 'id'={:id=>"foo"} 這裏是我的設置 User.rb class User < ApplicationRecord extend FriendlyId friendly_id :last_name, use: %i[slugged finders] Use

    0熱度

    2回答

    我使用friendy_id來加密我的網址。我的舊的URL中使用的樣子如下: localhost:3000/search?category_id=208 現在看起來是這樣的: localhost:3000/search?category_id=metal-processing-and-machine-tool 我的控制器是這樣的: def search_equipments begin

    0熱度

    1回答

    我想這 Opportunity.find_by_friendly_id(params[:id]) 與friendly_id Rails應用程序配置裏面。我得到 undefined method `find_by_friendly_id' for #<Class:0x007f8060395ca0> Did you mean? find_by_sql 有趣的是,這個工程: Opportunit

    0熱度

    3回答

    我在現有的源代碼上實現了friendly_id。情景就是這樣。主頁上有category名稱。當用戶點擊這些類別中的任何一個鏈接時,當它具有該類別下的產品時,會將它們帶到頁面。此頁面有分頁。在執行friendly_id之後,之前的網址曾經有category_id=number,我的網址爲category_id=name。 舊的URL: localhost:3000/search?category_i

    0熱度

    1回答

    我正在嘗試使用Friendly_id gem,它適用於用戶編輯,但不適用於用戶顯示頁面。在用戶展示頁面上,它仍然使用用戶標識,而不是用戶名,這是slug。我不確定我的錯誤是什麼,謝謝你的幫助。 路線 class User < ApplicationRecord extend FriendlyId friendly_id :user_name, use: :slugged en

    0熱度

    2回答

    我不明白爲什麼會發生這種情況,似乎即使找到了friendly.id文章的id也被查詢。即使在與評論關聯時找到正確的article_id(59),我發現的任何文章的ID都爲「0」。 Processing by ArticlesController#show as HTML Parameters: {"id"=>"javascript-8"} User Load (0.6ms) S

    0熱度

    1回答

    我將User(has_one:profile)模型鏈接到配置文件(belongs_to:user)模型。 我將使用用戶名來扼殺配置文件的URL,友好的應該在用戶或配置文件模型中實現? 謝謝!

    0熱度

    1回答

    我有兩種模式 - Post和Page,它們都有從第一個斜槓開始的路徑。例如: domain.com/first-slug - 這是後 domain.com/second-slug - 這是第 我可以創建遊戲控制器,其ContentController和這樣的進程slug: class ContentsController < ApplicationController def show

    -2熱度

    1回答

    使用Rails 4和FriendlyId Gem版本5.Im新的Friendly id寶石。在這裏,我想替換我的Url,像profile-name- {4(或)5 length random numbers}而不是profile-name-Long-UUID。由於

    -1熱度

    1回答

    我有兩個控制器和型號Projects和Schemas。 Schemasbelongs_to項目。 Projectshas_manyschemas。我正在尋找http://localhost:3000/projects/SLUG-PROJECT/schemas/SLUG-SCHEMA。 以下是我SchemaController代碼: class Projects::SchemasController