Skip to content

@unclemantis /notifier.rb secret
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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
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
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
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.