Created
July 3, 2012 11:43
-
-
Save ashga/3039252 to your computer and use it in GitHub Desktop.
user gets logged out.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Spree::RewardsRegistrationController < ApplicationController | |
def index | |
if !current_user | |
redirect_to spree.login_path | |
else | |
#render :text => "TEST ID" | |
user = Spree::User.find(Spree::User.current.id) | |
user.rewards ? @filled = true : @filled = false | |
end | |
end | |
def create | |
new_reg = Spree::RewardsRegistration.new(params[:rewards_registration]) | |
new_reg.save! | |
user = Spree::User.find(new_reg.user_id) | |
user.rewards = true | |
user.save! | |
rp = Spree::RewardsPoint.new(:awarded => 250, :used => 0, :user_id => new_reg.user_id) | |
rp.save! | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment