RailsCasts Pro episodes are now free!

Learn more or hide this

Nunzio Fiore's Profile

GitHub User: nunziofiore

Site: http://www.laboop.com

Comments by Nunzio Fiore

Avatar

nice, the smell of the dark side :)
but it's better to avoid this kind of structures because it kills searching, sorting, filtering and other common features... don't you think?

Avatar

Hi Ryan, this tutorial is great. Do you think is possible to have a similar tutorial for socket/comet/push interupt service?

Avatar

what do you think about using this solution mixed whit delayed job for large cvs?

Avatar

"That’s it for this episode on PayPal. It was longer than usual but it’s still not feature complete as we need to handle customers who have insufficient funds or who cancel their subscriptions. These may be covered in a future episode."

PLEASE RYAN, COVER IT :D

Avatar

Perhaps it's a dumb question but imagine that you have 400.000 products

in this chain of wheres conditions (with pagination)

ruby
 products = Product.order(:name)
    products = products.where("name like ?", "%#{keywords}%") if keywords.present?
    products = products.where(category_id: category_id) if category_id.present?
    products = products.where("price >= ?", min_price) if min_price.present?
    products = products.where("price <= ?", max_price) if max_price.present?
    products.page(params[:page])

The search execute the first, and then filter with the other where condition so you have a 400.000 products search that kill performances, or am I totally (I wish) wrong?

Avatar

I ve got the solution, what do you think about that

application.html.erb

ruby
<!DOCTYPE html>
<html>
  <head>
    <title>Cinematron</title>
    <%= stylesheet_link_tag    "application", media: "all" %>
        <% if current_user %>
        <script>
                at = '<%=current_user.oauth_token%>'
        </script>
        <% else %>
        <script>
                at = ''
        </script>
        <% end %>
....

facebook.js.coffee.erb

ruby
  if $('#sign_out').length > 0
    FB.getLoginStatus (response) ->
      if ((!response.authResponse) ||((at != response.authResponse.accessToken)))
        FB.login (response) ->
          window.location = '/auth/facebook/callback' if response.authResponse
        , scope: "email,publish_stream"

In this way when auth token is expired but user is connected you have an automatic relogin client side.

Curious for your opinion
Bye
Nunzio

Avatar

what do you think about an aproach like this?

if $('#sign_out').length > 0
FB.getLoginStatus (response) ->
if !response.authResponse
FB.login (response) ->
window.location = '/auth/facebook/callback' if response.authResponse
, scope: "email,publish_stream"

Avatar

Great episode
When last month fb revoked the offline-access token perms, I had several rework in my apps.

In which way do you managed this?
https://developers.facebook.com/roadmap/offline-access-removal/
Somebody has an example?
In next railscasts you will cover this?
The problem is, I want to post something in user wall while he uses my app throught a mobile api, for example. If the accesstoken user stored when he logged first time expire, how did you manage this case?
(sorry for my terrible english)
Nunzio

Avatar

thank you but i have a loop :( don't know why

Avatar

Great
I have trouble with assets and ssl in production . Anybody knows if is it a known issue?
Nnz

Avatar

where can I find a revised and updated demo/tut for something like Rails3.1.2 "polling-for-changes" like this great but not updated screencasts: http://railscasts.com/episodes/229-polling-for-changes?view=asciicast ?

answer also here if u want
http://stackoverflow.com/questions/8760791/where-can-i-find-a-revised-and-updated-demo-tut-for-something-like-rails3-1-2-p

thank you

Avatar

Ryan
blog_after and blog_before are not updated in download package