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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T06:45:04+00:00 2026-06-08T06:45:04+00:00

I have a link that looks like this in the object’s show view: <%=

  • 0

I have a link that looks like this in the object’s show view:

<%= link_to "Approve", object_path(@object, status: true), method: :put, confirm: "Are you sure?", class: 'button' %>

The update action in the controller is standard and the object’s regular edit form works just fine. But for some reason, this link isn’t updating the boolean field to true…

Is there something that I did wrong with this link?

EDIT: Update Section of Controller

def update
  @object = Object.find_by_certain_field(params[:id])
  if @object.update_attributes(params[:object])
    flash[:success] = "Object Updated"
    redirect_to @object
  else
    render 'edit'
  end
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-06-08T06:45:06+00:00Added an answer on June 8, 2026 at 6:45 am

    object_path(@object, status: true) causes params[:status] to be true and not params[:object][:status] as you wish, thus not updating the object with @object.update_attributes(params[:object])

    If you want to keep using the current code pattern just add

    parmas[:object] ||= {} 
    params[:object][:status] = params[:status] if params[:status]
    

    before

    if @object.update_attributes(params[:object])
    

    and everything should be fine.

    Otherwise I’d avise you to make a form for this update call:

    <% form_for @object, :method => :put do |f| %>
      <%= f.hidden_field :status, :value => true %>
      <%= f.submit "Approve" %>
    <% end %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a link that looks like this: <a onclick=myLightbox rel=lightbox href=image.jpg title=> I
I have a JSON object that looks like this. [ { id : 23,
I have a json structure that looks something like this: list:[ { type:link, href:http://google.com
i have an object that, at its most basic level, looks like this: #include
I have a link which looks like that: www.domain.com/file.php I want to create .htaccess
...well, actually I have an object which looks like this: object(AleParserXMLElement)#39 (4) { [name:private]=>
I have a nested form in a rails view that is called like this
I have a template class that looks something like this: template<class T> class C
I have a jQuery ajax call that looks like this: $.ajax({ type : 'GET',
I have some xml that looks like this: <?xml version=1.0?> <data> <items> <item><timestamp>2011-07-11T09:01:42Z</timestamp><title><![CDATA[ some

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.