secret
Created

  • Download Gist
gistfile1.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
RuntimeError in UsersController#create
 
You can no longer call ActionMailer::Base.default_url_options directly. You need to set config.action_mailer.default_url_options. If you are using ActionMailer standalone, you need to include the routing url_helpers directly.
Rails.root: /home/unclemantis/rails_projects/raffle
 
Application Trace | Framework Trace | Full Trace
app/models/notifier.rb:1:in `<top (required)>'
app/models/user.rb:16:in `deliver_activation_instructions!'
app/controllers/users_controller.rb:78:in `create'
Request
 
Parameters:
 
{"utf8"=>"✓",
"authenticity_token"=>"cH4BxobYWSd9bB6Kq4kT8aR4HNVAIP2E4ov8ro1Wn9g=",
"user"=>{"username"=>"unclemantis2fff3434433ddd433",
"email"=>"unclemanti3fff3ddds32@gmail.com",
"password"=>"[FILTERED]",
"password_confirmation"=>"[FILTERED]"},
"commit"=>"Create User"}
Show session dump
 
Show env dump
 
Response
 
Headers:
 
None
notifier.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
class Notifier < ActionMailer::Base
def activation_instructions(user)
subject "Activation Instructions"
from "Binary Logic Notifier <noreply@binarylogic.com>"
recipients user.email
sent_on Time.now
body :account_activation_url => register_url(user.perishable_token)
end
 
def activation_confirmation(user)
subject "Activation Complete"
from "Binary Logic Notifier <noreply@binarylogic.com>"
recipients user.email
sent_on Time.now
body :root_url => root_url
end
end
user.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
class User < ActiveRecord::Base
acts_as_authentic
attr_accessible :username, :login, :email, :password, :password_confirmation, :openid_identifier
 
def active?
active
end
 
def activate!
self.active = true
save
end
 
def deliver_activation_instructions!
reset_perishable_token!
Notifier.activation_instructions(self).deliver
end
 
def deliver_activation_confirmation!
reset_perishable_token!
Notifier.activation_instructions(self).deliver
end
end
users_controller.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
include Rails.application.routes.url_helpers
class UsersController < ApplicationController
# GET /users
# GET /users.xml
def index
@users = User.all
 
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @users }
end
end
 
# GET /users/1
# GET /users/1.xml
def show
@user = User.find(params[:id])
 
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @user }
end
end
 
# GET /users/new
# GET /users/new.xml
def new
@user = User.new
 
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @user }
end
end
 
# GET /users/1/edit
def edit
@user = User.find(params[:id])
end
 
# POST /users
# POST /users.xml
# def create
# @user = User.new(params[:user])
#
# respond_to do |format|
# if @user.save
# format.html { redirect_to(@user, :notice => 'User was successfully created.') }
# format.xml { render :xml => @user, :status => :created, :location => @user }
# else
# format.html { render :action => "new" }
# format.xml { render :xml => @user.errors, :status => :unprocessable_entity }
# end
# end
# end
 
# def create
# @user = User.new(params[:user])
#
# respond_to do |format|
# if @user.save
# format.html { redirect_to(:users, :notice => 'Registration successfull.') }
# format.xml { render :xml => @user, :status => :created, :location => @user }
# else
# format.html { render :action => "new" }
# format.xml { render :xml => @user.errors, :status => :unprocessable_entity }
# end
# end
# end
 
def create
@user = User.new(params[:user])
 
# Saving without session maintenance to skip
# auto-login which can't happen here because
# the User has not yet been activated
if @user.save_without_session_maintenance
@user.deliver_activation_instructions!
flash[:notice] = "Your account has been created. Please check your e-mail for your account activation instructions!"
redirect_to root_url
else
render :action => :new
end
end
 
# PUT /users/1
# PUT /users/1.xml
def update
@user = User.find(params[:id])
 
respond_to do |format|
if @user.update_attributes(params[:user])
format.html { redirect_to(@user, :notice => 'User was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @user.errors, :status => :unprocessable_entity }
end
end
end
 
# DELETE /users/1
# DELETE /users/1.xml
def destroy
@user = User.find(params[:id])
@user.destroy
 
respond_to do |format|
format.html { redirect_to(users_url) }
format.xml { head :ok }
end
end
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.