Not much to update. No break throughs. Lots of frustrations. I'm just working hard and studying everyday. Riding the cycle of feeling accomplished to feeling like the dumbest person ever.
I've been going through Jumpstart Labs Blogger Tutorial. Spend most of the day figuring out the section on tagging.... creating Tag and Taggable models and using the Taggable model to set the relationships between Articles and Tags. Learning about foreign keys (think I got it), but got really really hung up today on this:
def tag_list=(tags_string)
tag_names = tags_string.split(",").collect{|s| s.strip.downcase}.uniq new_or_found_tags = tag_names.collect { |name| Tag.find_or_create_by(name: name) } self.tags = new_or_found_tagsend
particularly the first line of:
def tag_list=(tags_string)
This took me hours (HOURS!) this evening/night to figure out.... never seen def method equals something in my rails work before! And it took me hours to figure out this is a setter. I think I understand it now.... since tag_list is not defined in the Article model/table/schema as an attribute it can't save the tag_list when it tries to create the new Article object. we have to define it in a method in the Article model (what we are doing above) so our tag values we input in the form when we create a new article will be saved. Lots of googling and talking about it with my husband and re-reading this part of the tutorial over and over, and I finally got it. WHEW.