Jump to content

The ultimate community for Ruby on Rails developers.


Paperclip interpolation

rails paperclip gems

  • Please log in to reply
1 reply to this topic

#1 robzdc



  • Members
  • 4 posts

Posted 27 October 2013 - 05:25 PM

Hi, Im trying to save my file by an id from a 3rd table, the db looks like this


Page      <--           Document       <--         Edition


id                            id                                 id

document_id        edition_id                    



So what Im trying to do is to get the edition_id so the path file would look like /edition_id/document_id/file.extension


I know that I could just add the edition_id to Page, but I want to know if there is a solution without doing that.



#2 jerome___



  • Members
  • 6 posts

Posted 16 November 2013 - 01:21 PM

i'm not sure, but i think you can just declare relationship between tables as rails method implemented (has_many / belongs_to) in each models (each model follow each table) and then, create each controller (scaffolding) for each model.

Then, just need after that to make your views and add the routes in the /config/routes.rb file dedicated to do what you need.

Because for each call of url, you need a view (show for one show or index for a list... as teach on every rails tutorials, but this can be defined by your own methods and routes create...); and for each entry create, you need maybe a view for do it (but it is not an obligation).


So, if i real understand your need, this follow exactly what can rails can provide (same reflexion of construction).

For the end, it will probably be the route configuration who can give you precisely what you want.


but... I'm just a newbie... so... i'm not sure to real understand what you want to do and if it is correct vision for resolve it.

Also tagged with one or more of these keywords: rails, paperclip, gems

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users