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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:36:14+00:00 2026-05-31T16:36:14+00:00

I have multiple fields for social networking websites where users can enter their username

  • 0

I have multiple fields for social networking websites where users can enter their username and it would link to their twitter, facebook, myspace account etc. My problem is how can I have it so when a user enters their username I can link to their account.

Here’s what I have and I know this is probably not correct. In my profile index.html

<%= link_to twitter_url %>

profile helper method

def twitter_url
  return(self.url= "http://twitter.com/#{profile.twitter}/account")
end

In my profile controller

include ProfilesHelper

The actual field in database is called

twitter_link

How can I get the just the user username then on my part which will do the rest link to their twitter, facebook etc account page?

  • 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-05-31T16:36:15+00:00Added an answer on May 31, 2026 at 4:36 pm

    How is that method supposed to know what the profile object is without you passing it in?

    I’m imagining there being a @profile variable defined in your controller. In the view, you would have this:

    <%= link_to twitter_url %>
    

    And in the helper, this:

    def twitter_url
      "http://twitter.com/#{@profile.twitter_link}/account"
    end
    

    Note here that you don’t need to set self.url or have an explicit return. This is because the method will automatically return a String which is what link_to takes.

    If you want this method to be in a helper that’s available in just your ProfileController, then why not put it inside ProfileHelper so that it’s automatically included just by being related by name?

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

Sidebar

Related Questions

If I have multiple text fields and would like to have a button that
I have products with multiple fields than can be searched (name, text, product code,
Is there a field in django that can have multiple foreign key fields? I
I have a scenario where I would like to update multiple fields in multiple
I have a form with multiple fields that I'm validating (some with methods added
I have a form that has multiple fields, and for testing purposes is there
I have a Custom Control that has multiple textbox fields and a checkbox contained
I have a registration form with common registration fields and two multiple selection Lists
I'm trying to achieve the following functionality. Within a form I have multiple fields
I have multiple hidden form fields which store values about the the current view

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.