Is there a way to pass parameters by calling link_to without it appearing on the URL? I make a simple star rating system, and I basically make each star a link to an image that passes its value as a parameter for a new rendering of the same page. The helper code looks like this:
def stars_generator(edit_mode = false)
@rating = params[:stars].to_i
@stars = Array.new(5) {|i| i+1}
output = "<div class = 'star_container'>"
case edit_mode
when true
@stars.each do |star|
if star <= @rating
output += link_to image_tag('star_rated.png', :mouseover => 'star_hover.png'), review_new_url(:stars => star)
else
output += link_to image_tag('star_empty.png', :mouseover => 'star_hover.png'), review_new_url(:stars => star)
end
end
when false
@stars.each do |star|
if star <= @rating
output += image_tag('star_rated.png')
else
output += image_tag('star_empty.png')
end
end
end
output += "</div>"
return output
end
It works fine, but currently the star rating is displayed as a parameter in the url. Ideally, I would like to hide this information somehow, and I tried both hidden_field_tag ββand hidden_tag, none of which work. Is there no way to do this, or am I just completely noob?
source
share