Still can't the stripe integrated into my App New users controller class UsersController < ApplicationController before_action :logged_in_user, only: [:index, :edit, :update, :destroy, :following, :followers]
before_action :correct_user, only: [:edit, :update] before_action :admin_user, only: :destroy def index @users = User.where(activated: true).paginate(page: params[:page]) end def show @user = User.find(params[:id]) redirect_to root_url and return unless @user.activated? end def new @user = User.new end def create @user = User.new(user_params) # Amount in cents @amount = 2000 customer = Stripe::Customer.create( :email => params[:stripeEmail], :source => params[:stripeToken] ) charge = Stripe::Charge.create( :customer => customer.id, :amount => @amount, :description => 'Rails Stripe customer', :currency => 'usd' ) rescue Stripe::CardError => e flash[:error] = e.message redirect_to new_charge_path if @user.save @user.send_activation_email flash[:info] = "Please check your email to activate your account." redirect_to root_url else render 'new' end end def edit @user = User.find(params[:id]) end def update @user = User.find(params[:id]) if @user.update_attributes(user_params) flash[:success] = "Profile updated" redirect_to @user else render 'edit' end end def destroy User.find(params[:id]).destroy flash[:success] = "User deleted" redirect_to users_url end Adjusted routes incorporating charges Rails.application.routes.draw do root 'static_pages#home' get 'password_resets/new' get 'password_resets/edit' get 'sessions/new' get 'users/new' get '/help', to: 'static_pages#help' get '/about', to: 'static_pages#about' get '/contact', to: 'static_pages#contact' get '/signup', to: 'users#new' post '/signup', to: 'users#create' get '/login', to: 'sessions#new' post '/login', to: 'sessions#create' delete '/logout', to: 'sessions#destroy' get 'game/BlackJack' get 'game/Poker' get 'game/Yaghtzee' get 'game/MasterMind' get '/blackjack', to: 'game#BlackJack' get '/poker', to: 'game#Poker' get '/yaghtzee', to: 'game#Yaghtzee' get '/mastermind', to: 'game#MasterMind' get '/charges', to:'charges#new' resources :charges resources :users resources :game, only: [:BlackJack, :Poker, :Yaghtzee, :MasterMind] resources :account_activations, only: [:edit] resources :password_resets, only: [:new, :create, :edit, :update] end New users Form with stripe <%= form_for(@user) do |f| %> <%= render 'shared/error_messages', object: f.object %> <%= f.label :name %> <%= f.text_field :name, class: 'form-control' %> <%= f.label :email %> <%= f.email_field :email, class: 'form-control' %> <%= f.label :password %> <%= f.password_field :password, class: 'form-control' %> <%= f.label :password_confirmation %> <%= f.password_field :password_confirmation, class: 'form-control' %> <article> <% if flash[:error].present? %> <div id="error_explanation"> <p><%= flash[:error] %></p> </div> <% end %> <label class="amount"> <span>Amount: $20.00</span> </label> </article> <script src="https://checkout.stripe.com/checkout.js" class="stripe-button" data-key="<%= Rails.configuration.stripe[:publishable_key] %>" data-description="Membership Subscription" data-amount="2000" data-locale="auto"> </script> <%= f.submit yield(:button_text), class: "btn btn-primary" %> <% end %> I'm getting this error NoMethodError in Users#new Showing */home/dave/Documents/Rails/TestApps/GamesRailsProjectWithStripeAugust8/SampleApp/app/views/users/_form.html.erb* where line *#30* raised: undefined method `stripe' for #<Rails::Application::Configuration:0x00000003eea4c8> Extracted source (around line *#30*): 282930313233 <script src="https://checkout.stripe.com/checkout.js" class="stripe-button" data-key="<%= Rails.configuration.stripe[:publishable_key] %>" data-description="Membership Subscription" data-amount="2000" data-locale="auto"> Trace of template inclusion: app/views/users/new.html.erb Rails.root: /home/dave/Documents/Rails/TestApps/GamesRailsProjectWithStripeAugust8/SampleApp Application Trace <http://localhost:3000/signup#> | Framework Trace <http://localhost:3000/signup#> | Full Trace <http://localhost:3000/signup#> app/views/users/_form.html.erb:30:in `block in _app_views_users__form_html_erb___950734916984809011_70292180440780' <http://localhost:3000/signup#> app/views/users/_form.html.erb:1:in `_app_views_users__form_html_erb___950734916984809011_70292180440780' <http://localhost:3000/signup#> app/views/users/new.html.erb:7:in `_app_views_users_new_html_erb___3169716253547301234_70292180550600 <http://localhost:3000/signup#> I am relatively new to rails and have idea to solve this problem. On Fri, Aug 10, 2018 at 12:12 AM Walter Lee Davis <wa...@wdstudio.com> wrote: > There is a link at the bottom of each message you receive from this list, > where you can do just that. Nobody else here can delete you, we are all > users, not admins. > > Walter > > > On Aug 9, 2018, at 5:30 AM, Mauro Sanna <mrsan...@gmail.com> wrote: > > > > Please delete me. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscr...@googlegroups.com. > To post to this group, send email to rubyonrails-talk@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/rubyonrails-talk/B60E8D0E-CDE6-471B-B21D-E36494302960%40wdstudio.com > . > For more options, visit https://groups.google.com/d/optout. > -- Dave Merrick Daves Web Designs Website http://www.daveswebdesigns.co.nz Email merrick...@gmail.com Ph 03 216 2053 Cell 027 3089 169 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CA%2B%3DMcKYVfnJqoUZATJL7bm9ng_EqwwOkTvPhNQe762qq8_%3DsAw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.