Browse files

new accounts get a default award; keeps logic simpler

  • Loading branch information...
1 parent 0a436d0 commit 18dcc7427ec7b12e484e275e218f480f9325067d @drnic committed Apr 20, 2011
Showing with 17 additions and 15 deletions.
  1. +5 −1 app/models/user.rb
  2. +4 −7 app/views/home/index.html.haml
  3. +8 −7 db/seeds.rb
View
6 app/models/user.rb
@@ -6,8 +6,12 @@ def self.create_with_meetup(auth)
user = create! do |user|
user.provider = auth["provider"]
user.uid = auth["uid"]
- user.update_with_omniauth(auth)
+ user.update_with_meetup(auth)
end
+ debugger
+ award = Award.find_by_name("Created an account")
+ user.award_users.create(:award => award)
+ user
end
# Sets User attributes based on omniauth/meetup.com fields
View
11 app/views/home/index.html.haml
@@ -1,14 +1,11 @@
- if current_user
%h1 Your Awards
- - if current_user.awards.count > 0
- %ul
- - current_user.awards.each do |award|
- %li= award.name
+ %ul
+ - current_user.awards.each do |award|
+ %li= award.name
- %p Have you been granted new awards? Fill it in below!
- - else
- %p Have you been granted an award? Fill it in below!
+ %p Have you been granted new awards? Fill it in below!
%p TODO - form to create/assign awards to self. In development, in the console, try:
%pre
View
15 db/seeds.rb
@@ -1,7 +1,8 @@
-# This file should contain all the record creation needed to seed the database with its default values.
-# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
-#
-# Examples:
-#
-# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
-# Mayor.create(:name => 'Daley', :city => cities.first)
+awards = [
+ "Created an account",
+ "First meeting"
+]
+awards.each do |name|
+ Award.create(:name => name)
+ puts "Initial award: #{name}"
+end

0 comments on commit 18dcc74

Please sign in to comment.