How to create a url for notification in Rails

Posted by Salil on Stack Overflow See other posts from Stack Overflow or by Salil
Published on 2010-04-12T07:18:01Z Indexed on 2010/04/12 7:23 UTC
Read the original article Hit count: 392

Filed under:
|

Hi All,

i want to send an email to user after he sign-up with code.for ex

http://192.168.1.51:3000/logins/activate/435546dgfd757676657 #link contains in an email

how can i create the above URL in my notifier model. i know following way

url_for :controller=>'logins', :action=>'activate', :id=>'435546dgfd757676657' , :host=>'http://192.168.1.54:3000'

Which is working properly. what i want that host should not be hard coded. How can i get host with port in a model.

In controller i can find it using follwing ways

request.host_with_port

Please provide me correct ruby way for doing same.

© Stack Overflow or respective owner

Related posts about ruby

Related posts about ruby-on-rails