I have created a xml file that I want to change into and rss feed and
then parse it so it looks anyother rss feed. The file takes data from my
database but I am at a loss on how to get this to an rss feed, can
anyone help?
view
xml.instruct! :xml, :version=>"1.0"
xml.product_record do
@products.each do |p|
xml.itemtype(p.item_type)
xml.itemname(p.item_name)
xml.description(p.description)
xml.sellername(p.seller_name)
xml.selleremail(p.seller_email)
end
end
controller
class InfoController < ApplicationController
def prodlist
@products = Product.find(:all, :order=> "item_name")
render :layout => false
end
end
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Hey Alan. Here''s how I create RSS in Rails:
view
xml.instruct!
xml.rss "version" => "2.0", "xmlns:dc" =>
"http://purl.org/dc/elements/
1.1/" do
xml.channel do
@products.each do |p|
xml.title(p.item_name)
xml.link(url_for :only_path => false, :controller =>
''products'')
xml.description(p.description)
end
end
end
That''d get you the basics. Is that all you need?
ESPNDev
On Mar 20, 1:05 pm, Alan Red
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> I have created a xml file that I want to change into and rss feed and
> then parse it so it looks anyother rss feed. The file takes data from my
> database but I am at a loss on how to get this to an rss feed, can
> anyone help?
>
> view
>
> xml.instruct! :xml, :version=>"1.0"
> xml.product_record do
> @products.each do |p|
> xml.itemtype(p.item_type)
> xml.itemname(p.item_name)
> xml.description(p.description)
> xml.sellername(p.seller_name)
> xml.selleremail(p.seller_email)
> end
> end
>
> controller
>
> class InfoController < ApplicationController
> def prodlist
> @products = Product.find(:all, :order=> "item_name")
> render :layout => false
> end
> end
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
ESPNDev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> Hey Alan. Here''s how I create RSS in Rails: > > view > > xml.instruct! > > xml.rss "version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/ > 1.1/" do > xml.channel do > @products.each do |p| > xml.title(p.item_name) > xml.link(url_for :only_path => false, :controller => ''products'') > xml.description(p.description) > end > end > end > > That''d get you the basics. Is that all you need? > > ESPNDevThat works really well, not sure why it only shows one item will have to figure taht out but definatly a great starting point thanks. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ok I tried ro find out whats wrong by validating the rss feed and it
complains that there are too many titles and such. I believe this could
be the problem as to why is not showing all the products but im at quite
a loss can anyone help?
source code
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/
1.1/">
<channel>
<title>Fiat</title>
<link>http://localhost:3000/products</link>
<description>In good condition, 5 years old.</description>
<sellername>KLSexxy</sellername>
<selleremail>her2stay-q62pSR/7JGc@public.gmane.org</selleremail>
<title>Great Hits</title>
<link>http://localhost:3000/products</link>
<description>Greatist rock hits ever!!</description>
<sellername>JAY01</sellername>
<selleremail>JAY01-deqWdTs+PzCuvtTkCOosKA@public.gmane.org</selleremail>
<title>Trek</title>
<link>http://localhost:3000/products</link>
<description>Proffesional Trek riding bike, want to sell for no less
than £50. The bike can be delivered or can be collected. Please
contact via email.</description>
<sellername>JG02</sellername>
<selleremail>heresay-PkbjNfxxIAQqdlJmJB21zg@public.gmane.org</selleremail>
</channel>
</rss>
Whats appears on site
Trek
________________________________________________________________________________
Proffesional Trek riding bike, want to sell for no less than £50. The
bike can be delivered or can be collected. Please contact via email.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Long wrote:> I believe you are missing <item></item> tags. You need to wrap each > product as an item grouping. For examples of a working RSS feed I > suggest you pull your favorite source and have a look inside. > > -- Long > http://FATdrive.tv/wall/trakb/10-Long > http://FATdrive.tv/ - store, play, share > > ----- Original Message ----- > From: "Alan Red" <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > To: <rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > Sent: Friday, March 21, 2008 5:38 AM > Subject: [Rails] Re: RSS feed helpLong thanks so much, got it fully working. It looks fantastic considering its only for a uni project but every bit counts thanks again -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I believe you are missing <item></item> tags. You need to wrap each
product as an item grouping. For examples of a working RSS feed I
suggest you pull your favorite source and have a look inside.
-- Long
http://FATdrive.tv/wall/trakb/10-Long
http://FATdrive.tv/ - store, play, share
----- Original Message -----
From: "Alan Red"
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
To: <rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Sent: Friday, March 21, 2008 5:38 AM
Subject: [Rails] Re: RSS feed help
Ok I tried ro find out whats wrong by validating the rss feed and it
complains that there are too many titles and such. I believe this
could
be the problem as to why is not showing all the products but im at
quite
a loss can anyone help?
source code
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/
1.1/">
<channel>
<title>Fiat</title>
<link>http://localhost:3000/products</link>
<description>In good condition, 5 years old.</description>
<sellername>KLSexxy</sellername>
<selleremail>her2stay-q62pSR/7JGc@public.gmane.org</selleremail>
<title>Great Hits</title>
<link>http://localhost:3000/products</link>
<description>Greatist rock hits ever!!</description>
<sellername>JAY01</sellername>
<selleremail>JAY01-deqWdTs+PzCuvtTkCOosKA@public.gmane.org</selleremail>
<title>Trek</title>
<link>http://localhost:3000/products</link>
<description>Proffesional Trek riding bike, want to sell for no
less
than £50. The bike can be delivered or can be collected. Please
contact via email.</description>
<sellername>JG02</sellername>
<selleremail>heresay-PkbjNfxxIAQqdlJmJB21zg@public.gmane.org</selleremail>
</channel>
</rss>
Whats appears on site
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---