0

I know that in rails 2.3 there is :with option available with link_to form helper. The use of it is basically the append parameters to URL. But in rails 3.1 its not working, how can i append more parameters to path using link_to in rails 3.1. Here is how it worked in rails 2.3

I need to append to my path something i get from javascript.

<%= link_to "Edit", {:url => error_prone_teacher_students_path(@store), :remote => true, :with => "'id='+$('#id').val()", :method => :get}, :id => "load", :style=>"display:none;" %>
2

3 Answers 3

2

Rails 3 no more support this behaviour you have to create the form to submit value.

Sign up to request clarification or add additional context in comments.

1 Comment

yes, i figured it out, i will accept your answer so that others dont get stuck like i did
0

You can do like this

<%= link_to "Edit", error_prone_teacher_students_path(@store) + "?id=parameter", :remote => true, :method => :get, :id => "load", :style=> "display:none;" %>

Hope this helps!

1 Comment

Hi RSB, $F('id') is coming from javascript. i need to append a a parameter from javascript
0

Try this.

link_to "EDIT", error_prone_teacher_students_path(@store, q1: 1, q2: 2)

3 Comments

Hi, i need to append a parameter which is generated by Jquery
Then I guess, u need to append it runtime. may be like this. I m assuming u r getting a value in a variable. $("#link_id").attr(href, ($("#link_id").attr('href')+ "?id="+value))
Here is a good reference, in case u have jquery object which u want to convert and append. stackoverflow.com/questions/1714786/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.