Skip to content
Advertisement

Tag: model

How to test create model service?

I decided to create CreateClassroomService to separte logic in my controller method. I am trying to test this service as part of learning unit testing, but I don’t know how. I don’t know how to mock the classroom object to control what the method should return. Does this mean that creating this service was not a good idea because I

How to establish a one-to-many relationship to a model whose type is stored in db

I have a database that looks like this: Database Graphical Representation The dance_performer.perfomer_type field hosts values such at ‘AppDancer’, ‘AppCouple’ or ‘AppFormation’. How would you proceed to connect the dance_performer.perfomer_id to the different models? I am not sure how I am supposed to write the relationships in the different models. Should I create a AppPerformer model which would then direct

Advertisement