Browse the Ruby on Rails Community.

You are here: Forums Ask a Rails expert RSS...

Replytotopic

RSS

Posted in Forums : Ask a Rails expert

 
Atcaaac4eecompfcnizgu-dgz65i9p1tjty1hxko6wfsozkt835glzltxsfkxxnkkz7wafgyqhdw4woyfgaw-_xlmxosajtu9vbc4qhz46tprxtfdvbjmese-bfomq

Authority 37
Posting Rating 77
Sign in to rate this post

i am using rails 2.1.0

i am very cleared about RSS topic but

->how to install rss gems and from where ?

->where to start is again a big confusion ?
please help me
i am expecting fast replay

 
N739949849_5167

Authority 12
Posting Rating 98
Sign in to rate this post

Depends on what you needed done.

Do you need to parse a RSS feed?

Or do you want to generate your own RSS feed?

 
Atcaaac4eecompfcnizgu-dgz65i9p1tjty1hxko6wfsozkt835glzltxsfkxxnkkz7wafgyqhdw4woyfgaw-_xlmxosajtu9vbc4qhz46tprxtfdvbjmese-bfomq

Authority 37
Posting Rating 77
Sign in to rate this post

->how to install rss gems and from where ?(if it is needed )

I need to generate my own RSS feed

 
N739949849_5167

Authority 12
Posting Rating 98
Sign in to rate this post

Have you tried the tutorial here ?

 
Atcaaac4eecompfcnizgu-dgz65i9p1tjty1hxko6wfsozkt835glzltxsfkxxnkkz7wafgyqhdw4woyfgaw-_xlmxosajtu9vbc4qhz46tprxtfdvbjmese-bfomq

Authority 37
Posting Rating 77
Sign in to rate this post

i tried but can’t could you please explain in detail
with sample app

 
Me

Authority 62
Posting Rating 100
Sign in to rate this post

This tutorial is old and outdated – you should use a modern REST approach.

What you need is basically:
- auto_discovery_link_tag in your head section. Use formatted_whatever_url as the link. For example, if you have a post resource, this would be formatted_posts_url(:rss) (or even better :atom).
- In your PostsController#index, use a respond_to block and add format.rss (or format.atom).
- Create a corresponding template (app/views/posts/index.rss.builder or index.atom.builder) and create the basic xml structure in it that an RSS feed needs.
- If you use Atom instead of RSS, you can also use the AtomFeedHelper that ships with Rails.

 
Atcaaac4eecompfcnizgu-dgz65i9p1tjty1hxko6wfsozkt835glzltxsfkxxnkkz7wafgyqhdw4woyfgaw-_xlmxosajtu9vbc4qhz46tprxtfdvbjmese-bfomq

Authority 37
Posting Rating 77
Sign in to rate this post

where to add format.rss (or format.atom).

 
N739949849_5167

Authority 12
Posting Rating 98
Sign in to rate this post

You add it in your controller code, inside the action which would render the feed.

 
Atcaaac4eecompfcnizgu-dgz65i9p1tjty1hxko6wfsozkt835glzltxsfkxxnkkz7wafgyqhdw4woyfgaw-_xlmxosajtu9vbc4qhz46tprxtfdvbjmese-bfomq

Authority 37
Posting Rating 77
Sign in to rate this post

in controllers i added ‘feed’ and ‘rss’ as actions
this format.rss means wat i should code
and thank you for your replay

 
N739949849_5167

Authority 12
Posting Rating 98
Sign in to rate this post

You don’t need to add a feed or rss actions in your controller. You can just add it to your index action. Lets assume you have a Post model and PostsController as an example.

class PostsController < ApplicationController

def index
@posts = Post.find(:all)
respond_to do |format|
format.atom
end
end

end
_

Create an app/views/posts/index.atom.builder file which contains the following:

atom_feed do |feed|
feed.title(“My Atom Feed”)
feed.updated((@posts.first.created_at))

for post in @posts
feed.entry(post) do |entry|
entry.title(post.title)
entry.content(post.body, :type => ‘html’)

entry.author do |author|
author.name(“EMF”)
end
end
end

Replytotopic

Other Recent Topics

Ask a Rails expert : How to work with ror 2.1.1 using Netbeans IDE 6.1

Ask a Rails expert : json gem error

Ask a Rails expert : Problem with break

Ask a Rails expert : activesupport string first method error

Ask a Rails expert : url_for broken ?

Ask a Rails expert : map.routes.rb pls help

Ask a Rails expert : how to h tag in controller

Ask a Rails expert : Problem with Restful routing and partial form

Ask a Rails expert : will_paginate, search and ajax

Ask a Rails expert : captcha

Formatting Help
  • *bold*       _italics_      
    bq. (quotes)
  • "DSC":http://www.dsc.net
  • * or # (lists)
or cancel