title: Rails create profile after sign up in devise
body: <p>i have installed devise in my app and now i want to create profile just after the individual(user) signed up and redirect them to the profile page </p>
  
  <p>here is my individual model</p>
  
  <pre><code>class Individual &lt; ActiveRecord::Base
    has_one :profile
    # Include default devise modules. Others available are:
    # :confirmable, :lockable, :timeoutable and :omniauthable
    devise :database_authenticatable, :registerable,
           :recoverable, :rememberable, :trackable, :validatable
  end
  </code></pre>
  
  <p>my profile model is </p>
  
  <pre><code>  class Profile &lt; ActiveRecord::Base
        belongs_to :individual
        before_create :build_profile
   def completed_profile?
      self.first_name.present? &amp;&amp; self.last_name.present? &amp;&amp; self.address_line_1.present? &amp;&amp; self.city.present? &amp;&amp; self.state.present? &amp;&amp; self.zipcode.present?
    end
      end
  </code></pre>
  
  <p>Migration file for profile is </p>
  
  <pre><code>class CreateProfiles &lt; ActiveRecord::Migration
    def change
      create_table :profiles do |t|
        t.belongs_to :individual, index: true
        t.string :first_name
        t.string :last_name
        t.string :age
        t.string :birth_date
        t.string :gender
        t.string :bio
        t.string :linkedin_profile
        t.string :facebook_profile
        t.string :twitter_profile
        t.integer :mobile_no
  
        t.timestamps null: false
      end
    end
  end
  </code></pre>
  
  <p>and my profiles controller is given as </p>
  
  <pre><code>class ProfilesController &lt; ApplicationController
      before_action :authenticate_individual!
      before_action :find_profile, only: [:show, :edit, :update, :destroy]
  
      respond_to :html
  
      def index
        @profiles = Profile.all
      end
  
      def new
        @profile = current_individual.build_profile
      end
  
      def create
        @profile = current_individual.build_profile(profile_params)
        if @profile.save
          flash[:success] = "Profile saved"
          redirect_to current_individual_path
        else
          flash[:error] = "Error"
          render :new
        end
      end
  
      def show
        @profile = Profile.find(params[:id])
      end
  
      def edit
      end
  
      def update
        @profile.update(profile_params)
        respond_with(@profile)
      end
  
  
      private
  
      def find_profile
        @profile = Profile.find(params[:id])
      end
  
      def profile_params
        params.require(:profile).permit(:first_name, :last_name, :birth_date,
                                        :gender, :bio, :personal_website, :linkedin_profile, :facebook_profile,
                                        :mobile_no, :telephone_no)
      end
    end
  </code></pre>
  
  <p>and i have the routes as</p>
  
  <pre><code>devise_for :individuals
  </code></pre>
  
  <p>my application controller has </p>
  
  <pre><code>class ApplicationController &lt; ActionController::Base
    # Prevent CSRF attacks by raising an exception.
    # For APIs, you may want to use :null_session instead.
    protect_from_forgery with: :exception
  
    def after_sign_in_path_for(resource)
      if current_individual.completed_profile?
        redirect_to root_path
      else
        redirect_to edit_individual_profile_path
      end
    end
  end
  </code></pre>
  
  <p>please tell me how can the user will be signed up and after signing in they would be redirected to profile's edit view where the individual can edit the profile 
  Thank you !!</p>