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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:53:54+00:00 2026-05-25T16:53:54+00:00

I want the user to click a link that will modify an ActiveRecord entry.

  • 0

I want the user to click a link that will modify an ActiveRecord entry. The record is called feed.disabled and the link will toggle that record between true and false. I made a helper method to determine the text for the link:

def disable_button(feed)
  if feed.disabled?
    return 'Enable Feed'
  else
    return 'Disable Feed'
  end
end

So my question is really two-fold. Will that helper work to display the correct text in the view, and how do I get that link to modify the feed.disabled record to true or false depending on what the current state is?

Edit to add methods based on Dave’s guide:

feeds_controller.rb:

def toggle_disabled_record
  @feed = Project.find(params[:project_id]).feeds.find(params[:id])
  @feed.toggle!(:disabled)
  render :nothing => true
end

projects->show.html.erb:

<%= link_to toggle_disable_button(feed), toggle_disabled_record_project_feed_path(feed) %>

routes.rb:

resources :projects do
  resources :feeds
end

resources :feeds do
  resources :xml_fields
  get toggle_disabled_record, :on => :member
end
  • 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-25T16:53:55+00:00Added an answer on May 25, 2026 at 4:53 pm

    Take a look at (my) this blog post; it’s a link, not a button, but more or less directly addresses this.

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

Sidebar

Related Questions

Suppose, I want to have a link or a button that when user click
I want a link that when you click on it, it will call a
I want to check when the user double click on applictaion icon that no
User click on a link button and it will direct them to a url
I had image for Products and i want user when click on image appear
i want to show all the vehicle maintenance history when user click on the
I want to allow the user to click a start point and then click
I don't want to allow user to double click on my button. On the
I have a div box with some images that the user can click. When
i have a html link that i want to popup a dialog box with

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.