{"ref":"refs/heads/master","commits":[{"author":{"name":"James Mead","email":"474ba67bdb289c6263b36dfd8a7bed6c85b04943@floehopper.org"},"sha":"8cbfeb2936cdecc4901229998c49e247db3768dc","message":"Make Document::Traits::Trait methods more generic.\n\n* I'm going to need to add a has_one association that needs to be copied *before* the save of the document. This doesn't fit with the current method names, but they were a bit over-specific in any case.","url":"https://api.github.com/repos/alphagov/whitehall/commits/8cbfeb2936cdecc4901229998c49e247db3768dc"},{"author":{"name":"James Mead","email":"474ba67bdb289c6263b36dfd8a7bed6c85b04943@floehopper.org"},"sha":"7729789f891cdac86e407fcf282a4039357d8435","message":"Introduce a PublicationMetadatum model.\n\nThis is where we're storing new publication-specific attributes that don't belong in the main documents table.","url":"https://api.github.com/repos/alphagov/whitehall/commits/7729789f891cdac86e407fcf282a4039357d8435"},{"author":{"name":"James Mead","email":"474ba67bdb289c6263b36dfd8a7bed6c85b04943@floehopper.org"},"sha":"c312f3e996d8a0e4566ba7b8f57bb349483e963b","message":"Added admin functionality for extra publication fields.\n\n* I'm not terribly happy with the complexity introduced as a result of separating the extra fields into a separate table, but I think it's better than adding them to the documents table. Also I think it might be possible to simplify things in a subsequent commit by using delegation from the document to the extra fields.\n* We need to update all the existing publications to have mandatory metadata so they are all valid.","url":"https://api.github.com/repos/alphagov/whitehall/commits/c312f3e996d8a0e4566ba7b8f57bb349483e963b"},{"author":{"name":"James Mead","email":"474ba67bdb289c6263b36dfd8a7bed6c85b04943@floehopper.org"},"sha":"b8f47d050a76100ed169bc3fac4482de54fa1983","message":"Hide publication metadatum from clients of publication.\n\n* The fact that some of a publication's attributes are stored in a different table is of no concern to clients of the publication.\n* Automatically build a metadatum when a publication is built.\n* Delegate relevant attributes to the underlying metadatum model.\n* Move validation from the metadatum onto the publication. This has the advantage of significantly improving the validation error messages i.e. no mention of \"publication publication metadatum\".\n* Since we can copy the attributes, we no longer need the Document::Traits::Trait on publication that copied the metadatum. Although we did have to introduce the Document#document_attributes method.\n* This feels a little simpler overall than having the metadatum as a first-class model. For example, there is no longer any need to used the nested attributes stuff.\n* We need an after_save callback to ensure the underlying metadatum is saved when the publication is saved. Note that we use the bang version of save, because all metadatum validation is on publication so we can be sure that the metadatum will be valid. If the after_save callback fails for some unforeseen reason it will rollback the transaction including the publication save.\n* The only slight unpleasantness is that we've had to introduce a before filter to take care of the multi-parameter assignment for the publication_date. This is because ActiveRecord asks publication what type of attribute publication_date is, but publication doesn't know - only publication metadata knows. In some ways this feels more like a controller responsibility than a model responsibility anyway, so I'm not sure it's so awful.","url":"https://api.github.com/repos/alphagov/whitehall/commits/b8f47d050a76100ed169bc3fac4482de54fa1983"},{"author":{"name":"James Mead","email":"474ba67bdb289c6263b36dfd8a7bed6c85b04943@floehopper.org"},"sha":"9616c94dc503261eeaf13079d0c27fe97329e616","message":"Display new publication fields on published policy page.\n\nThis introduces some duplication in template content, but we can extract that in a subsequent commit.","url":"https://api.github.com/repos/alphagov/whitehall/commits/9616c94dc503261eeaf13079d0c27fe97329e616"}],"head":"9616c94dc503261eeaf13079d0c27fe97329e616","push_id":51414876,"size":5}