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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:07:18+00:00 2026-06-18T03:07:18+00:00

I have following method in one of my module def current_user end def current_user=(new_user)

  • 0

I have following method in one of my module

def current_user
end

def current_user=(new_user)
end

What i wanted to know is what is the use of the method current_user=(new_user).
I also like to know following things
1. Can we declare such methods in model, controller
2. how to call such methods
3. documentation link for such things

  • 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-18T03:07:20+00:00Added an answer on June 18, 2026 at 3:07 am

    By default all variables in ruby are private. It’s possible to access them only via methods (often named geters and setters). So

    def current_user
    end
    

    is getter and

    def current_user=(new_user)
    end
    

    is setter

    To better understand, you can read this article:
    http://zetcode.com/lang/rubytutorial/oop2/

    UPD: Such methods you can use in controllers, models – in any class

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

Sidebar

Related Questions

I have the following: module Thing def self.included(base) base.send :extend, ClassMethods end module ClassMethods
Assume I have one threadpool and each thread is running following method: void runMe(HashMap
I have the following method that returns void and I need to use it
I have an HTML form like this one: <form action=test method=post> <input name=first_name type=text/>
I have the following extension method that I've built and have working for one
I have the following Extension Method Imports System.Runtime.CompilerServices Namespace Extensions Public Module IntegerExtensions <Extension()>
If I have in one file the following: module Something class Resource # Defines
I have one module called UserProvider that looks like this var UserProvider = function(db)
I have following method in wcf webenabled service Public Person AddPerson(Person p); As of
I have following method which I am using to load ActiveX control dynamically, Dim

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.