Forum: Ruby on Rails how to use edit ajax link in controller.

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
46911700017303070d64f73b69bb04a8?d=identicon&s=25 Guest (Guest)
on 2007-03-08 06:17
hi all,

  i want to put the html coding in my controller, because i want to
return the value like this. but i don't how to declare here. i declared,
but it show error. i have listed my coding here. plese tell me what's
the error in this asap.

  @return_string+="<tr bgcolor=white>
                                   <td>" + company.street_addr + "</td>
                                   <td>" + "</td>
                                   <td>" +company.state + "</td>
                                   <td>" + + "</td>
                                   <td width=10>" + company.branch +
                                   <td width=10%>" +
                       link_to_remote 'EDIT',
    :update => 'detail',
   :with     =>"'company_id='+#{}",

    :url    => { :action => 'edit_comp' }

                                     + "</td></tr>"

my Error is:

app/controllers/oddworlders_controller.rb:197: syntax error, unexpected
tSTRING_BEG, expecting kDO or '{' or '('
                       link_to_remote "EDIT",
app/controllers/oddworlders_controller.rb:197: syntax error, unexpected
',', expecting kEND
app/controllers/oddworlders_controller.rb:198: syntax error, unexpected
',', expecting kEND
app/controllers/oddworlders_controller.rb:199: syntax error, unexpected
',', expecting kEND
5ef95bf95af5064ff3c2bcafa6a8a212?d=identicon&s=25 Dave M (Guest)
on 2007-03-09 09:38
(Received via mailing list)
Try this, Using the %{} make declaring a string over multiple lines
easer and then you can also use direct #{} substitution for the
variables which removes all the '+' and '"' characters.

@return_string += %{<tr bgcolor=white>
                      <td width=10>#{company.branch}</td>
                      <td width=10%>link_to_remote 'EDIT', :update =>
'detail', :with => "company_id=#{}", :url => { :action =>
'edit_comp' }</td>

This topic is locked and can not be replied to.