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 8330053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:59:55+00:00 2026-06-09T01:59:55+00:00

If the user doesn’t sign up with twitter or facebook the provider attribute is

  • 0

If the user doesn’t sign up with twitter or facebook the provider attribute is blank and the user is a pro user. I’ve added the pro attribute to the database as a boolean and the default is false.

I’m trying to toggle the pro attribute in the database to true using the code below.

  def pro?
    toggle!(:pro) if provider.blank? 
  end

However I get this error.

stack level too deep

I also tried
def pro?
:pro => true if provider.blank?
end
but get this error:

 syntax error, unexpected tASSOC, expecting keyword_end

Note I also need to use the pro method because it is used in many other places in the code.

  • 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-09T01:59:58+00:00Added an answer on June 9, 2026 at 1:59 am

    If you have the pro attribute defined as boolean, the following methods are all available for free:

    • pro? : returns the boolean value of the pro attribute
    • pro= : sets the value of pro

    A ruby method ending in a ? is expected to return a boolean, without any side-effects.

    What I would do, in your case, is add a callback:

    class User
    
      before_save :check_pro_status
    
      def check_pro_status
        pro = provider.blank?
      end
    
    end
    

    This will make sure that everytime something is changed in your user, before saving, it will set the pro-status correctly depending on the provider.

    Hope this helps.

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

Sidebar

Related Questions

I need to make multiple selection available by default, so the user doesn't have
I'm writing a disk crawler and if the user doesn't provide an existing path
I'm trying to write an IF ELSE statement to enable shipping, If user doesn't
It doesn't look like the response contains a 'user' object for items and there
I want to write a custom validator which doesn't do anything before the user
This is my problem. If a user disconnect from channel and doesn't connect back
I am greying out a web page when a user doesn't have permission to
Using forms authentication, is it possible to return a 404 if a user doesn't
I have a class with a date. If the user doesn't change it in
I have this: <meta name=viewport content=width=device-width, user-scalable=no /> So the user doesn't need to

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.