small fix from id to title.

This commit is contained in:
rulingcom 2025-04-22 16:47:28 +08:00
parent d4adfc6b0e
commit dc5e24dcf2
1 changed files with 7 additions and 2 deletions

View File

@ -143,8 +143,12 @@ class VideoProsController < ApplicationController
end end
end end
hashtag = nil
if params[:hashtag].present? if params[:hashtag].present?
video_images = video_images.where(video_tag_ids: params[:hashtag]) hashtag = VideoTag.where(:title => params[:hashtag]).first rescue nil
if !hashtag.nil?
video_images = video_images.where(video_tag_ids: hashtag.id)
end
end end
custom_data_field = (page.custom_data_field || {} rescue {}) custom_data_field = (page.custom_data_field || {} rescue {})
@ -162,8 +166,9 @@ class VideoProsController < ApplicationController
{"option"=>"<option value=\"#{tag[:value]}\" #{tag[:is_selected]}>#{tag[:name]}</option>"} {"option"=>"<option value=\"#{tag[:value]}\" #{tag[:is_selected]}>#{tag[:name]}</option>"}
end end
hashtag_id = hashtag.id.to_s rescue nil
hashtags = VideoTag.all.map do |tag| hashtags = VideoTag.all.map do |tag|
{"hashtag" => tag.title, "hash_url" => request.base_url + request.path + "?hashtag=#{tag.id.to_s}", "selected" => (params[:hashtag] == tag.id.to_s ? "selected" : "")} {"hashtag" => tag.title, "hash_url" => request.base_url + request.path + "?hashtag=#{tag.title}", "selected" => (hashtag_id == tag.id.to_s ? "selected" : "")}
end end
{ {
"extras" => { "extras" => {