Topic: Creating a specific relationship between models

Hi, I'm new to ruby on rails and have been following this online tutorial book by Michael Hartl

http://ruby.railstutorial.org/ruby-on-r … orial-book

The changes I have made to it were instead of creating "Microposts", I created a model called "Tag", which will be the database representation of a real world NFC/RFID Tag. Each "Tag" has a Reference Number and Location Information. I have created relationship between the User and the Tag, so that a user can have many tags, and a Tag belongs to a User, Tags can be created, edited, updated, deleted and shown in a paginated list.

  class Tag < ActiveRecord::Base
  attr_accessible :ref, :location_info
  belongs_to :user
  
  validates :user_id, presence: true
  validates :location_info, presence: true, length: { maximum: 200 }
  validates :ref, presence: true, length: { maximum: 30 }
  
  default_scope order: 'tags.created_at DESC'
  end

Seeing as I am new to rails and haven't got a complete grasp on it, and am running slightly on a tight schedule to get the last part of this done I was hoping someone could help me out. In the tutorial itself there is an example case of users "following" and "unfollowing" each other like on Twitter. I attempted to map this to my own project because I want the Tag objects to be able to be connected to each other like in a Path(like a property graph). I was unable to do so by using that example though.

I want to present the user who has a list of tags, with a "Create Relationship" page, where they choose a tag from a list of tags which would act as the "from" and then another tag from the list which would act as the "to", while supplying that relationship with "directional information". (like in a property graph where the relationship can have an attribute, the directional information would be the attribute of the from and to relationship). I'm really unsure about how to go about this and I was hoping someone could give me an idea

My code is here at https://github.com/eoghanmiggan/nfc_campus/

and you are welcome to clone the project and give it a shot if you think you can help, I would greatly appreciate this! It's the beginning of building a system on a college campus to aid the navigation of visually impaired students around the college

Thanks for your time!