Greetings RoR Friends! I would SO APPRECIATE your help with a question.
I
have read the Rails Guides, Stack Overflow, and tutorials but still seem
to
fail at grasping some basic RoR Association Conventions.
I will share with you the gist of the project layout and a picture of my
models and associations. Please let me know if this is correct.
Especially
if the "has_and_belongs_to_many is reduntant.
Overview: A web application where a church profile can be logged into by
multiple users. These users will upload sermons which can be viewed from
the church profile. The church profile categorizes the sermons based on
either the speaker, a series, or a topic. That’s it!
Here is a picture of my models. Is this the correct way?
What about your sermon model? I think this would be the more important
one
so that we could help you out.
Some stuff that could help:
will a specific user only have access to one church? or more than one?
what is the role of the speaker? is it just the user who posted the
sermon or some sort of author of it? not necessarily being the user that
submitted it?
about speakers, series and topics, those are just for simply filtering
the given sermons?
Greetings RoR Friends! I would SO APPRECIATE your help with a question. I have
read the Rails Guides, Stack Overflow, and tutorials but still seem to fail at
grasping some basic RoR Association Conventions.
I think that just reading through tutorials is not enough. Work right
through a good tutorial such as railstutorial.org (which is free to
use online) including doing all the exercises and so on. That will
give you a much better understanding of what rails is all about. It
will take a few days but you will re-coup that very rapidly.
Regarding the speaker and sermon. You only need HABTM between speaker
and
sermon if a sermon has more than one speaker. Otherwise you can use the
regular has_many. But you seem to have a grasp of this so you may
realize
this.
Also for topics you may want to use a Rails tagging gem instead of your
own
topic model. You can investigate this one which the most
popular: https://github.com/mbleigh/acts-as-taggable-on
Also you have the fields incorrect for your HABTM. in a HABTM
association
the id table will be separate.