important-terabyte-39911
03/11/2022, 2:20 PMlemon-wall-20836
03/11/2022, 2:21 PMlemon-wall-20836
03/11/2022, 2:21 PMlemon-wall-20836
03/11/2022, 2:21 PMlemon-wall-20836
03/11/2022, 2:21 PMimportant-terabyte-39911
03/11/2022, 2:26 PMlemon-wall-20836
03/11/2022, 2:26 PMlemon-wall-20836
03/11/2022, 2:26 PMlemon-wall-20836
03/11/2022, 2:26 PMimportant-terabyte-39911
03/11/2022, 2:26 PMlemon-wall-20836
03/11/2022, 2:26 PMimportant-terabyte-39911
03/11/2022, 2:26 PMimportant-terabyte-39911
03/11/2022, 2:26 PMlemon-wall-20836
03/11/2022, 2:27 PMimportant-terabyte-39911
03/11/2022, 2:27 PMclean-salesmen-51708
03/12/2022, 8:40 PMfriendly_id
for slugs.
ruby
class Page < ApplicationRecord
extend FriendlyId
friendly_id :title, use: :slugged
has_rich_text :content
validates_presence_of :title, :content
end
My Avo resource looks like this.
ruby
class PageResource < Avo::BaseResource
self.title = :title
field :id, as: :text
field :title, as: :text
field :content, as: :trix
field :visible, as: :boolean
end
In Avo creating a new Page record with the rich text works but viewing the created record in Avo throws an ActiveRecord::RecordNotFound in Avo::PagesController#show
Couldn't find Page with 'id'=about
clean-salesmen-51708
03/12/2022, 8:41 PMruby
module Avo
class ApplicationController < ::ActionController::Base
def set_model
@model = if params[:id].is_a?(Integer)
eager_load_files(@resource, @resource.class.find_scope).find params[:id]
else
eager_load_files(@resource, @resource.class.find_scope).find_by(slug: params[:id])
end
end
end
end
lemon-wall-20836
03/13/2022, 1:41 PMlemon-wall-20836
03/13/2022, 1:41 PMlemon-wall-20836
03/13/2022, 1:41 PMlemon-wall-20836
03/13/2022, 1:41 PMfriendly_id
example 👆clean-salesmen-51708
03/13/2022, 6:08 PMadamant-hair-45776
03/24/2022, 12:27 PMfield :id, as: :id
field :name, as: :text, required: true, sortable: true
lemon-wall-20836
03/24/2022, 12:40 PMlemon-wall-20836
03/24/2022, 12:40 PMlemon-wall-20836
03/24/2022, 12:40 PMlemon-wall-20836
03/24/2022, 12:41 PMlemon-wall-20836
03/24/2022, 12:41 PMavo.js
loading in the network tab?lemon-wall-20836
03/24/2022, 1:11 PMadamant-hair-45776
03/24/2022, 1:27 PM