RailsCasts Pro episodes are now free!

Learn more or hide this

Christian Gambardella's Profile

GitHub User: nerdyglasses

Comments by Christian Gambardella

Avatar

Doesn't painting.image.recreate_versions! do the trick?

Avatar

No, I didn't know that those exist!

Thank you!

Avatar

We used it on http://www.moviebreak.de/

It is a German Movie Website.

We had trouble with the mobile first aspect on IE8, because IE8 doesn't support media queries.

I hated to use !important all the time to override Foundation defaults.

Avatar

In a model I only want to find those which didn't expire, yet.

For that I have a scope:

ruby
# Mongoid
scope :live, gt(ends_at: Time.now)

Should I use Time.current instead? I don't feel like I got the point :)
When I set this variable :ends_at, should I use Time.current + 30.days ?

Thx for the great work!

Avatar

You are right. Sometimes there where multiple ajax requests.
This script only fires one time, removes the eventlistener on scroll end adds it when finished.

This works with turbolinks.

coffeescript
onEndless = ->
  $(window).off 'scroll', onEndless
  url = $('.paginator .next a').attr('href')
  $('.paginator').hide()
  if url && $(window).scrollTop() > $(document).height() - $(window).height() - 150
    $('.loader').show()
    $.getScript url, ->
      $(window).on 'scroll', onEndless
  else
    $(window).on 'scroll', onEndless

$(window).on 'scroll', onEndless
  
$(window).scroll()
Avatar

Thx for this episode. Where is part 2? :)

I think this episode needs a part 2 or maybe part 3 episode since most rails apps are more complex. Would be great to have a proof of concept for a website with different pages, authentication, authorization.

Have a nice day.

Avatar

what would be the best strategy to combine it with e.g. omniauth-facebook?