Access image from different view in a view with paperclip gem ruby on rails

后端 未结 2 1955
你的背包
你的背包 2021-01-27 15:01

I\'m new in Ruby on Rails and learning it. I want to access a table with images stored by paperclip gem in another view, for example in my application, I have the causes control

2条回答
  •  执笔经年
    2021-01-27 15:24

    You are sending Profile.all into @profile that means @profile is going to be an array of profile objects. your method images will work on one object of Profile class, not on multiple. You need to select the proper profile and assign it to @profile. For EX :

    @profile = Profile.first # just taking the first profile, you can select any.
    

    In view , now you can use this @ profile to get an image.

提交回复
热议问题