madebymany / sir-trevor-rails

Rails gem for Sir Trevor integration.
MIT License
149 stars 50 forks source link

Empty video block causes render failure #39

Open firedev opened 9 years ago

firedev commented 9 years ago
module SirTrevorRails
  module Blocks
    class VideoBlock < SirTrevorRails::Block
      def to_partial_path
        "sir_trevor/blocks/videos/" << self.source 
        # source is empty here so rendering content causes
        # no implicit conversion of nil into String
      end
    end
  end
end
ninjabiscuit commented 9 years ago

Thanks for reporting :+1:. Looks like we need to check for presence of self.source and fall back to a default or render nothing. For now you can override this method yourself by creating a file called video_block in app/sir_trevor_blocks. It's worth noting that the default behaviour of ST video block is to provide a source. It's worth checking that your data is saving correctly.

firedev commented 9 years ago

Ok, just a heads-up.

dwb commented 9 years ago

I think the bigger question here is, how does the block data get validated and by whom? If this gem assumes it's valid, and source is required, the code is fine as-is.