On May 26, 2014, at 8:00 AM, Fab Forestier <li...@ruby-forum.com> wrote:
> But the in the methode ajouter how can I have something like > @myvariable=n or @myvariable=@defautrec[i] where I is the current line > of the table? <%= link_to controller: "pages", action: "ajouter", id: n %> But your code is otherwise so messed up that I can't tell exactly what you're trying to do. What is the "do" at then end of the call to link_to? Is the <%end%> after </button> intended to be associated with it? Or is it supposed to be for the @defautrec.each, but is just in the wrong place? I suspect you're trying to wrap a button in a link, but that's not how HTML works, regardless of whether you're using Rails or not. Do you just want a button that acts like a link??? It that's the case, you want button_to: <http://stackoverflow.com/questions/12475299/ruby-on-rails-button-to-link-to> <http://stackoverflow.com/questions/6247491/rails-3-display-link-as-button> Anyway, you cannot just stick "do" at the end of a function call in order to start a loop. Remember, <%= %> just executes the Ruby code inside and inserts the result into the HTML, and this is not legitimate Ruby: link_to controller: "pages", action: "ajouter" do Or, for more clarity, since this is the way it would be parsed: link_to (controller: "pages", action: "ajouter" do) -- Scott Ribe scott_r...@elevated-dev.com http://www.elevated-dev.com/ (303) 722-0567 voice -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/AB790A24-89A2-4114-97D0-1D6A18C13C7F%40elevated-dev.com. For more options, visit https://groups.google.com/d/optout.