Aplicações tipo Canvas no Redu com Rails

234 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
234
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Aplicações tipo Canvas no Redu com Rails

  1. 1. Aplicações tipo Canvas comRailsGuilherme CavalcantiLíder técnico, plataforma de aplicativosThursday, 28 February 13
  2. 2. ContextoThursday, 28 February 13
  3. 3. O que já aprendemos?Assunto Nº de AulasIntrodução ao Ruby 1REST e OAuth 1Consumindo APIs REST com Ruby 1Introdução ao Rails 2Uso do canvas 1Componentes de interface do Redu 2Thursday, 28 February 13
  4. 4. Na aula de hoje• OAuth no Rails• Aplicações tipo Canvas no Rails• Uso do Redu BootstrapThursday, 28 February 13
  5. 5. OAuth no RailsThursday, 28 February 13
  6. 6. Temos um Gem paraisso :)omniauth-reduThursday, 28 February 13
  7. 7. 1: Gemfile1 source https://rubygems.org23 gem rails, ~> 3.2.104 gem omniauth-redu• Adicionar gem omniauth-reduThursday, 28 February 13
  8. 8. 1: routes.rb1 Autoregulation::Application.routes.draw do2 match /auth/:provider/callback, :to => sessions#create3 match /auth/:provider, :to => sessions#create, as: :create_session4 end• Rota que dá início a autenticação• Rota de callbackThursday, 28 February 13
  9. 9. 1: Controller1 class SessionsController < BaseController2 def create3 @user = User.find_by_uid(auth_hash[uid]) ||4 User.create_with_omniauth(auth_hash)56 session[:user_id] = @user.id78 redirect_to root_path9 end1011 protected1213 def auth_hash14 request.env[omniauth.auth]15 end16 endThursday, 28 February 13
  10. 10. ReferênciaautorregulacaoThursday, 28 February 13

×