Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

rails action text about text and picture display on different location

I use rails develop blog use Avtion Text

create and show is successful.


def  show
    require "image_processing/mini_magick"
    @comment=PostComment.new
    @[email protected]_comments.includes(:post).order(id: :desc)
    
  end

  def create

    @post=current_user.posts.new(@clear_params)
    if @post.save
     redirect_to root_path
    else
       render :new   
    end
  end

In the home page ,I want list each article

  1. I need get article first picture how can i do?
  2. I want show only text how can i do? I try to use "to_plain_text" but keep show picture name enter image description here
question from:https://stackoverflow.com/questions/65898135/rails-action-text-about-text-and-picture-display-on-different-location

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

question 2 I use <%= sanitize_action_text_content(post.content.body)%> solve now I hope get first picture place the content nearby


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...