if (b = params[:birthplaces]&.without('')).present? User.search_by(params[:search_query]) .where(birthplace: b) .paginate(page: params[:page]) else User.search_by(params[:search_query]) .paginate(page: params[:page]) end end end
if: :saved_change_to_content? private def tag tags.clear unless tags.empty? self.tags = content.scan(/(?<=#)[^\s#]+/).uniq.map do |w| Tag.find_or_create_by!(name: w) end end end