Continuation of feature #128 . See first PR #134 .
This cleans up the Listing controller and fixes some issues in the previous PR:
Ilegal? now just returns the discriminatory flag
On before_save we detect if there is any discriminatory phrases and update the flag. We need to do this before we save since this is a column in the database. Doing this after_save would not update this in the table.
On after_save we create a PhraseListing table entry if there is a discriminatory listing. This is done after_save since a new listing needs a id to be inserted into the join table
Adds a uniqueness requirement to the PhraseListing table.
Continuation of feature #128 . See first PR #134 .
This cleans up the Listing controller and fixes some issues in the previous PR:
Ilegal?
now just returns the discriminatory flagbefore_save
we detect if there is any discriminatory phrases and update the flag. We need to do this before we save since this is a column in the database. Doing thisafter_save
would not update this in the table.after_save
we create aPhraseListing
table entry if there is a discriminatory listing. This is doneafter_save
since a new listing needs aid
to be inserted into the join tablePhraseListing
table.