Questions tagged [button-to]

67 questions
0
votes
1 answer

rails button_to current_user correct path

What path can I use to display a current_user's own listed products? = button_to "View My Products", root_path, method: :get, class: "button" Instead of root_path I tried to use @product.user.all which did not work. Thanks! edit: user…
user4932805
0
votes
2 answers

I am trying to rewrite a button_to

I'm trying to rewrite the following button code so that instead of redirecting me to the show page, it just creates the object and the current page stays displayed.
  • <%= button_to…
  • justin
    • 57
    • 4
    0
    votes
    1 answer

    Change link_to to a button in a Nested Model form

    Ok i just got done implementing a nested Form from http://railscasts.com/episodes/196-nested-model-form-part-1 http://railscasts.com/episodes/197-nested-model-form-part-2 These videos are great but now i want to customize the links and make them…
    Big Al Ruby Newbie
    • 834
    • 1
    • 10
    • 30
    0
    votes
    1 answer

    Rails button_to not working for some buttons, working for others within .each

    I'm making a list of promotions where each should be deleteable. In the view, for each promotion, I've made a button_to button that should run the delete action in the controller when it is clicked. However, all but the FIRST button work correctly.…
    user4282707
    0
    votes
    2 answers

    Rails: Pass ID of nested resource from button_to to controller / to toggle boolean in admin view

    I am sitting here since the Dawn of Times trying to toggle a boolean in Rails for an admin to validate submissions. I have a standard "Article" model, which has_many "Prosols" (which in turn belongs_to "Article"). A Prosol has a boolean…
    Jando
    • 3
    • 4
    0
    votes
    1 answer

    button_to breaks styling from bootstrap 3 button tag

    I had some tags like this:
    Codejoy
    • 3,722
    • 13
    • 59
    • 99
    0
    votes
    1 answer

    How to toggle a boolean one way with button_to

    I have 2 buttons sitting in an if else method and the first button is suppose to allow the user to change a boolean from false to true. Then if the model shows it is true it will show the other button which is a delete button. I cant get the toggle…
    SupremeA
    • 1,519
    • 3
    • 26
    • 43
    0
    votes
    2 answers

    Button_to link results in routing error

    I'm attempting to put some slick buttons on my rails app to serve as links. However, I'm running into an odd problem in my attempt to do so. I've attempted to add a link button as follows: <%= button_to( "New", :action => "new", :controller =>…
    neanderslob
    • 2,633
    • 6
    • 40
    • 82
    0
    votes
    1 answer

    how do I create a button_to make a new entry_field within a form.

    I want to make a button that will allow me to create a new text_field for :phone_number in addition to the one I already have. For example if I want to submit two phone number instead of one in separate fields how would that be accomplished? In the…
    Billy
    • 823
    • 3
    • 12
    • 28
    0
    votes
    1 answer

    Rails: Is it possible to Trigger a mailer method with a link_to or button_to method?

    I'm trying to create an admin Tool where the admins can send emails that are already there with a button. I have a class FamilyMailer < ActionMailer::Base with this method birthdaymailer Is there a way for me to trigger this from the view ? I have…
    0bserver07
    • 3,390
    • 1
    • 28
    • 56
    0
    votes
    1 answer

    Rails: Use a value of a field as a parameter

    I'm building a quizz application in which the user can enter the correct answer into a number field. I want to use the value in this field as a parameter in the button_to method to create a new answer. If i click the button, it does create a new…
    shann
    • 21
    • 2
    0
    votes
    1 answer

    Ruby on Rails Route not found with button_to, but not with link_to

    I have a problem with routing in my app, but i do not understand why. I hope someone can explain me why this is so. thank you very much for help. <%= link_to 'Show', restaurant_path(restaurant), :id => 'button_show_restaurant', :class => 'btn…
    damir
    • 1,928
    • 1
    • 16
    • 26
    0
    votes
    1 answer

    Non Mass assignable field in view

    Iam kinda stuck at this problem. Trying to update a non mass-assignable attribute in the job model from an admin view. I need a button which trigger an action method in the admin controller which just changes job's isactive value to true. In admin…
    0
    votes
    1 answer

    Button_to No route matches [GET] "/new_user_path"

    I am trying to get the page to be directed to the directory users/new, using a button_to However everytime I click on it, it generates an error saying Routing Error No route matches [GET] "/new_user_path" Here is my application.html.haml which…
    0
    votes
    1 answer

    avoid button_to action with javascript in rails

    I am making a shopping cart and the user can only add products to the cart when signed in. I created some JavaScript for when the user clicks the button "Add to cart", it evaluates if someone is signed in and displays a message, but I need to stop…
    Marion
    • 335
    • 1
    • 4
    • 15