- just check for existance before accessing in services initializer
- before_validation has no option :post
- dry up routes.rb
This commit is contained in:
MrZYX 2011-06-02 12:32:21 +02:00
parent 9f7a066a44
commit 668c4ddfc5
3 changed files with 18 additions and 10 deletions

View file

@ -16,7 +16,7 @@ class User < ActiveRecord::Base
:timeoutable, :token_authenticatable
before_validation :strip_and_downcase_username
before_validation :set_current_language, :post => :create
before_validation :set_current_language, :on => :create
validates_presence_of :username
validates_uniqueness_of :username

View file

@ -1,10 +1,15 @@
# Copyright (c) 2010, Diaspora Inc. This file is
# Copyright (c) 2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
Rails.application.config.middleware.use OmniAuth::Builder do
provider :twitter, SERVICES['twitter']['consumer_key'], SERVICES['twitter']['consumer_secret']
provider :tumblr, SERVICES['tumblr']['consumer_key'], SERVICES['tumblr']['consumer_secret']
provider :facebook, SERVICES['facebook']['app_id'], SERVICES['facebook']['app_secret'], :scope => "publish_stream,email,offline_access"
end
if SERVICES['twitter'] && SERVICES['twitter']['consumer_key'] && SERVICES['twitter']['consumer_secret']
provider :twitter, SERVICES['twitter']['consumer_key'], SERVICES['twitter']['consumer_secret']
end
if SERVICES['tumblr'] && SERVICES['tumblr']['consumer_key'] && SERVICES['tumblr']['consumer_secret']
provider :tumblr, SERVICES['tumblr']['consumer_key'], SERVICES['tumblr']['consumer_secret']
end
if SERVICES['facebook'] && SERVICES['facebook']['app_id'] && SERVICES['facebook']['app_secret']
provider :facebook, SERVICES['facebook']['app_id'], SERVICES['facebook']['app_secret'], :scope => "publish_stream,email,offline_access"
end
end

View file

@ -1,4 +1,4 @@
# Copyright (c) 2010, Diaspora Inc. This file is
# Copyright (c) 2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
@ -87,12 +87,15 @@ Diaspora::Application.routes.draw do
resources :aspect_memberships, :only => [:destroy, :create, :update]
resources :post_visibilities, :only => [:update]
get 'people/tag_index' => 'people#tag_index'
resources :people, :except => [:edit, :update] do
resources :status_messages
resources :photos
get :contacts
post 'by_handle' => :retrieve_remote, :on => :collection, :as => 'person_by_handle'
collection do
post 'by_handle' => :retrieve_remote, :as => 'person_by_handle'
get :tag_index
end
end