lundi 9 mars 2020

undefined method `name' for nil:NilClass activerecord (3.2.13) lib/active_record/associations/has_many_association.rb:

Once we design the card in the studio page after login we are facing this error please help me out. I have a very simple controller A NoMethodError occurred in studio#create_flatz, Thank you in advance

ruby version 1.9.3
rails 3.2.13

    class StudioController < ApplicationController
      before_filter :current_or_guest_user, :only =>[:create_flatz]

      def splash_page

      end


      def index
      end


      def create_flatz
      @cart=current_cart  
        @CartCount = @cart.total_quantity.to_s
      end
        def upload_art

      end
      def current_cart
       @cart ||= Cart.find(session[:cart_id])
       rescue ActiveRecord::RecordNotFound
       @cart = Cart.create
       session[:cart_id] = @cart.id
       @cart
      end
    end

Aucun commentaire:

Enregistrer un commentaire