Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8192789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:15:19+00:00 2026-06-07T04:15:19+00:00

For the last days , I am trying to apply a beta invite system.

  • 0

For the last days , I am trying to apply a beta invite system. I followed railcasts lesson 124. And I customised it for my users .

My routes.rb

resources :invitations, only: [:new, :create]
match '/signup/:invitation_token',  to: 'users#new'

Invitation model :

class Invitation < ActiveRecord::Base
  attr_accessible :new, :recipient_email, :user_id, :sent_at, :token

  belongs_to :user
    has_one :recipient, :class_name => 'User'

    validates_presence_of :recipient_email
    validate :recipient_is_not_registered
    validate :user_has_invitations, :if => :user

    before_create :generate_token
    before_create :decrement_user_count, :if => :user

    private

    def recipient_is_not_registered
        errors.add :recipient_email, 'zaten siteye üye' if User.find_by_email(recipient_email)
    end

    def user_has_invitations
        unless user.invitation_limit > 0
            errors.add_to_base 'Siteye davetiyeniz kalmamıştır.'
        end
    end

    def generate_token
        self.token = Digest::SHA1.hexdigest([Time.now, rand].join)
    end

    def decrement_user_count
        user.decrement! :invitation_limit
    end
end

Invitations_controller :

class InvitationsController < ApplicationController
    def new
        @invitation = Invitation.new
    end

    def create
        @invitation = Invitation.new(params[:invitation])
        @invitation.user = current_user
        if @invitation.save
            if signed_in?
                Mailer.deliver_invitation(@invitation, signup_path(@invitation.token))
                flash[:notice] = "Teşekkürler,davetiniz gönderildi."
                redirect_to root_path
            else
                flash[:notice] = "Teşekkürler,sizi almaya hazır olduğumuzda bildireceğiz."
                redirect_to root_path
            end
        else
    render :action => 'new'
        end
    end
end

.
This is my mailer.rb:

def invitation(invitation, signup_url)
  subject    'Siteye Davet'
  recipients invitation.recipient_email
  from       'foo@example.com'
  body       :invitation => invitation, :signup_url => signup_path
  invitation.update_attribute(:sent_at, Time.now)
end

When I sent an invitation , my log file shows :

 INSERT INTO "invitations" ("created_at", "recipient_email", "sent_at", "token", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?, ?)  [["created_at", Wed, 04 Jul 2012 21:55:13 UTC +00:00], ["recipient_email", "neveryt@gmail.com"], ["sent_at", nil], ["token", "c29e2dcc22c033a1e975f5755795db9f2a8fd5c2"], ["updated_at", Wed, 04 Jul 2012 21:55:13 UTC +00:00], ["user_id", 1]]
   (131.3ms)  commit transaction
Completed 500 Internal Server Error in 208ms

NoMethodError (undefined method `signup_path' for #<InvitationsController:0x000000044ef508>):

I can understand i must change the signup_url’s. But I cant find the correct way.How can i fix the invitation create action?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T04:15:21+00:00Added an answer on June 7, 2026 at 4:15 am

    You need to change the match statement in your routes.rb to this:

    match '/signup/:invitation_token',  to: 'users#new', as: 'signup'
    

    This will inform Rails that signup_path is the name for the matched route linking to /signup/:invitation_token.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've spent the last few days trying to remove memory leaks in my game,
I am trying to show the last xx days in my chart but how
I am trying to list last a website's statistics. I listed Last 30 days
I'm trying out AndEngine (GLES2) in the last couple of days. I'm having a
I spent the last three days trying to create a small app using SDL
I've spent the last 2 days trying to figure this out, basically I have
Last several days I was trying to set up a proper local SVN (with
I've spent last 2 days trying to launch examples from Boost.Python with the ImportError:
I have spent the last 2 days trying to find out how to do
I've spent so much time the last few days trying to work out some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.