Ruby on rails 3 如何让“照片”url(…)起作用?
photo_urlPhoto.first,:host=>“foobar”返回http://foobar/photos/2vig0 . 我如何使用类似“photo”的东西做同样的事情呢?\u urlPhoto.first,:host=>foobar' 我是否需要执行类似“photo”.constantize.\u urlPhoto.first,:host=>“foobar”将字符串的两个部分连接在一起后,就可以使用send调用方法 假设@fn包含字符串photo: 或者,可能更清楚:Ruby on rails 3 如何让“照片”url(…)起作用?,ruby-on-rails-3,Ruby On Rails 3,photo_urlPhoto.first,:host=>“foobar”返回http://foobar/photos/2vig0 . 我如何使用类似“photo”的东西做同样的事情呢?\u urlPhoto.first,:host=>foobar' 我是否需要执行类似“photo”.constantize.\u urlPhoto.first,:host=>“foobar”将字符串的两个部分连接在一起后,就可以使用send调用方法 假设@fn包含字符串photo: 或者,可能更清楚: send(
send("photo" + "_url", Photo.first, :host => 'foobar')
你的网址呢
send("photo" + "_url", Photo.first, :host => 'foobar')