app/controllers/users_controller.rb
# use current_user to replace user id in URL. repalce all @user with current_user
use current_user to replace user id in URL. repalce all @user with current_user
use current_user to replace user id in URL . repalce all @user with current_user
def user_monthly_report
    @user = current_user
    @rentals = @user.rentals.past30days_rentals
    NotifyMailer.monthly_report(@rentals, @user).deliver_now
    flash[:alert] = "Monthly Email report is sent to your email."
    redirect_to :root
  end
def user_monthly_report @user = current_user @rentals = @user . rentals . past30days_rentals NotifyMailer . monthly_report ( @rentals , @user ) . deliver_now flash [ :alert ] = "Monthly Email report is sent to your email." redirect_to :root end
use current_user to replace user id in URL.
use current_user to replace user id in URL .
# raise params.inspect # if @rentals #   flash[:success] = "Successfully generated User's monthly Rental Report" # end