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

  • Home
  • SEARCH
  • 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 3432982
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T07:31:04+00:00 2026-05-18T07:31:04+00:00

I have a block iterator to display a user and a related action to

  • 0

I have a block iterator to display a user and a related action to be displayed on the same line for every iteration.

You can visualize it like this:

user1  update_attribute_button
user2  update_attribute_button.
...
and so on.

If I use a button_to method the button is getting displayed on a newline. which I don’t want.

Here is my code snippet:

<% @post.bids.each do |bid| %>
  <p>
    <%= bid.user.email %>   
    <%= button_to "Offer Bid", offer_bid_post_bid_path(@post, bid), :action => "offer_bid">
  </p>
<% end %>  

But with the above code the ’email’ and ‘offer bid’ appear on two separate lines, but I want to display them both on the same line.

If I use link_to instead of button_to I’m able to achieve my idea, but not able to do it with a button_to. What is the difference between link_to and button_to?
I want to display the ‘offer bid’ as a button only.
How do I make the button_to button appear on the same line as the ’email’?

Please let me know if the question’s description is not clear.
Thanks in advance.

  • 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-18T07:31:04+00:00Added an answer on May 18, 2026 at 7:31 am

    A button_to generates a form and a div around the button. So, if you do not restrict the width of the container which is before the button, it will take 100% of the width pushing the button down.

    <% @post.bids.each do |bid| %>
      <p>
        <div style="float: left; width: auto;"><%= bid.user.email %></div>   
        <%= button_to "Offer Bid", offer_bid_post_bid_path(@post, bid), :action => "offer_bid" %>
      </p>
    <% end %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some code i'd like to refactor that uses a C# iterator (ie
A few related questions about the async CTP: I can iterate over an Iterator
I have a block of product images we received from a customer. Each product
I have a block of code that works and I wanted to ask what
I have a block of JSP code that needs to be used in several
I have a block of code that basically intializes several classes, but they are
I have a block of code that is repeated within a DB2 stored procedure.
I have a block element (DIV) who stretches across an entire page. It contains
I have a block of text that im taking from a Gedcom ( Here
I have a block of HTML: <ul> <li>a</li> <li>b</li> <li class=nav>c</li> <li class=nav>d</li> </ul>

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.