URLs wrongly formatted when sending emails. Rails 3.2 -


i have managed send emails (gmail) rails 3.2 application no apparent problems. however, urls genrated in email have :id param wrongly positioned.

notificationmailer

default :from => 'no-reply@somedomaiin.com' def report_spam(comment)     @comment = comment      mail(:to => "admin@somedomaiin.com", :subject => "inappropriate content report")   end 

certainemail.html.haml

reported by: " = link_to @comment.reports.last.user.name, users_url(@comment.reports.last.user) " %p  content of accused comment: %br " = link_to @comment.body, events_url(@comment.event.id) " %p 

the email @ inbox looks nice

reported by: " saben " content of accused comment:  " created superb event!! " 

however, both links urls are:

http://somedomaiin.heroku.com/saben/users http://somedomaiin.heroku.com/2/events 

and should be:

http://somedomaiin.heroku.com/users/saben http://somedomaiin.heroku.com/events/2 

this happens all/different mailers got. there obvious missing?

thanks in advance!

solution :

= link_to @comment.reports.last.user.name, user_url(:id => @comment.reports.last.user.id) " %p  content of accused comment: %br " = link_to @comment.body, event_url(:id => @comment.event.id) 

it may routing issue, in general if you're linking specific resource need member method event_url(@comment.event) rather events_url collection method.


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -