# Rss

**URL:** <https://www.ruby-forum.com/t/rss/92648>\
**Category:** Ruby\
**Created:** [April 22, 2007, 1:56pm UTC](https://www.ruby-forum.com/t/rss/92648 "2007-04-22T13:56:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![adriana](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/dfb087/32.png) [@adriana](https://www.ruby-forum.com/u/adriana)\
**Post date:** [April 22, 2007, 1:56pm UTC](https://www.ruby-forum.com/t/rss/92648/1 "2007-04-22T13:56:10Z")

</div>

Hi,

I’m trying to do RSS in my page, using ruby. Something is appearing in  
the browser, but I’m with some problems:  
1 - If I’m not logged in, nothing appears in the bookmark.  
2 - If I’m logged in, when I put another new in my data base, this one  
doesn’t appear in the bookmark  
3 - After closing the browser and close it again, the bookmark says  
â€œLive Bookmark feed failed to loadâ€.  
To solve the first problem, I must change my “noticias\_controller”… I  
must clear the line  
before\_filter :authorize, :except =\> [:show]  
but I think I’m using nothing more besides “show” from this controller.

Could you please tell me what is missing in my code?

File rss.rhtml

1. \<% for column in Noticia.content\_columns %\>
2. 

3. **\<%= column.human\_name %\>:** \<%=h @noticia.send(column.name)  
%\>
4. 

5. \<% end %\>

File feedxml.rhtml

1. xml.instruct! :xml, :version=\>“1.0”
2. 
3. xml.rss(‘version’ =\> ‘2.0’) do
4. 

```
xml.channel do

```

5. 

```
    xml.title('GEMCC News')

```

6. 

```
    xml.link ('http://localhost:3000/home')

```

7. 

```
    xml.description('Description.')

```

8. 

```
    xml.language('en-us')

```

9. 

```
    xml.pubDate('Sun, 9 Dez 2006 04:00:00 GMT')

```

10. 

```
    xml.lastBuildDate('Sun, 9 Dez 2006 04:00:00 GMT')

```

11. 
12. 

```
    for noticia in @noticia

```

13. 

```
        xml.item do

```

14. 

```
            xml.title(noticia.title)

```

15. 

```
            @noticia = Noticia.find(noticia.id)

```

16. 

```
            xml.description(@noticia.title + " - " +

```

@noticia.news)  
17. xml.link(‘[http://localhost:3000/home/rss/](http://localhost:3000/home/rss/)’ +  
noticia.id.to\_s)  
18. xml.pubDate(‘Sun, 9 Dez 2006 04:00:00 GMT’)  
19. xml.guid(‘[http://localhost:3000/home/rss/](http://localhost:3000/home/rss/)’ +  
noticia.id.to\_s)  
20. end  
21. end  
22. end  
23. end

A small parte of the file home\_controller.rb

1. def rss
2. @noticia = Noticia.find(params[:id])
3. end
4. 
5. def feedxml
6. @headers[“Content-Type”] = “application/rss+xml; charset=utf-8”
7. @noticia = Noticia.find(:all)
8. render\_without\_layout
9. end

File noticias\_controller.rb

1. class NoticiasController \< ApplicationController
2. 
3. before\_filter :authorize, :except =\> [:show]
4. 
5. def index
6. 

```
list

```

7. 

```
render :action => 'list'

```

8. end
9. 
10. 
# GETs should be safe (see \<a

href=‘[URIs, Addressability, and the use of HTTP GET and POST](http://www.w3.org/2001/tag/doc/whenToUseGet.html)’\>[URIs, Addressability, and the use of HTTP GET and POST](http://www.w3.org/2001/tag/doc/whenToUseGet.html))  
11. verify :method =\> :post, :only =\> [ :destroy, :create, :update  
],  
12. :redirect\_to =\> { :action =\> :list }  
13.  
14. def list  
15. @noticia\_pages, @noticias = paginate :noticias, :per\_page =\>  
10, :order =\> ‘date DESC’  
16. end  
17.  
18. def display  
19. end  
20.  
21. def procura  
22. @noticia\_pages, @noticias = paginate :noticias, :per\_page =\>  
10, :order =\> ‘title’,  
23. :conditions =\> [‘title LIKE ?’, params[:noticia][:title]]  
24. end  
25.  
26. def show  
27. @noticia = Noticia.find(params[:id])  
28. end  
29.  
30. def new  
31. @noticia = Noticia.new  
32. end  
33.  
34. def create  
35. @noticia = Noticia.new(params[:noticia])  
36. if @noticia.save  
37. flash[:notice] = ‘Noticia was successfully created.’  
38. redirect\_to :action =\> ‘list’  
39. else  
40. render :action =\> ‘new’  
41. end  
42. end  
43.  
44. def edit  
45. @noticia = Noticia.find(params[:id])  
46. end  
47.  
48. def update  
49. @noticia = Noticia.find(params[:id])  
50. if @noticia.update\_attributes(params[:noticia])  
51. flash[:notice] = ‘Noticia was successfully updated.’  
52. redirect\_to :action =\> ‘show’, :id =\> @noticia  
53. else  
54. render :action =\> ‘edit’  
55. end  
56. end  
57.  
58. def destroy  
59. Noticia.find(params[:id]).destroy  
60. redirect\_to :action =\> ‘list’  
61. end  
62.  
63. def feedxml  
64. @headers[“Content-Type”] = “application/rss+xml;  
charset=utf-8”  
65. @noticia = Noticia.find(:all)  
66. render\_without\_layout  
67. end  
68. end
