Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty video block causes render failure #39

Open
firedev opened this issue Apr 7, 2015 · 3 comments
Open

Empty video block causes render failure #39

firedev opened this issue Apr 7, 2015 · 3 comments

Comments

@firedev
Copy link

firedev commented Apr 7, 2015

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
firedev added a commit to firedev/sir-trevor-rails that referenced this issue Apr 7, 2015
@ninjabiscuit
Copy link
Contributor

Thanks for reporting 👍. 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
Copy link
Author

firedev commented Apr 7, 2015

Ok, just a heads-up.

@dwb
Copy link
Contributor

dwb commented Apr 7, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants