开发者

Problems with link to eval()in RoR

开发者 https://www.devze.com 2023-01-30 05:00 出处:网络
What am I doing wrong here? This seems to work fine earlier in my code: -@images.each do |img| -link_to eval(params[:action] + \'_image_path(img)\') do

What am I doing wrong here?

This seems to work fine earlier in my code:

-@images.each do |img|
          -link_to eval(params[:action] + '_image_path(img)') do
             =image_tag img.image.url(:thumbnail)

But this is not working. Why not?

 -link_to eval(params[:action] + '_image_path(@featured_image)') do
    =image_tag @featured_image.image.url(:display)

I am seeing "Uncaught TypeError: Cannot call method 'bind' of undefined" There seems to be an issue w开发者_如何学JAVAith calling _image_path(@featured_image)'. :(


Is it possible that @featured_image is undefined? That seems like what's happening here.

0

精彩评论

暂无评论...
验证码 换一张
取 消