add this to the Gemfile
gem 'auto_html`
Then create a field in the database to store the media URL
rails generate migration add_media_url_to_profiles media_url:string
rake db:migrate
Now add the auto_html functionality to the model
class Profile < ActiveRecord::Base
include AutoHtml
auto_html_for :media_url do
# Here you need to consult
# https://github.com/dejan/auto_html
# https://github.com/dejan/auto_html/tree/master/lib/auto_html/filters
# the important ones are
html_escape
youtube
end
end
Now update you views
# profile/_form.html.erb
<%= form_for @profile do |f| %>
<%= f.text_field :media_url %> <!-- not 100% sure about the syntax here -->
<%= end %>
```
````ruby
# profile/_show.html.erb
<%= @profile.media_url_html %>
```
Voila!
Hi Arne,
Thanks for your help!
Why do you update # profile/_form.html.erb instead of _profile.html.erb ?