Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 718 Vote(s) - 3.43 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What's the best way of structuring image associations (with metadata) in blog posts in ROR?

#1
I'm creating a model with a db table for my image uploads because each image is going to have multiple versions and is also going to have alt text, description, an optional caption, and a photo credit that needs to be carried with it.

My blog posts are going to have one or more of these images. I can select the table row for the image, chose the size, apply the CSS, and then cause that to generate in the body of my post. Fabulous! I don't think it makes any sense to have a has_many association here--I just want some arbitrary set of images to render in the body of the post. It's all content, not structure.

BUT one image will be special. Each blog post will have exactly one featured image. This is the image that will be used with the post on other pages, in previews, when it's linked to using twitter or facebook, etc. So I BELIEVE that I should have a has_one association from blog post to image, and a has_many (will probably have one, but just in case) from image to blog post.

I am COMPLETELY new to databases and a new to Rails, too. I just want a sanity check on this.

Thanks so much!!!!
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through