Posts Tagged ‘rubyonrails’

Invalid Authenticity Token Error in Rails

Got the following error today when trying to submit a form in Ruby on Rails:
ActionController::InvalidAuthenticityToken
The solution turned out to be as easy as inserting

into my form.
[via Nabble]

Setting Up Postgresql with Rails on Windows

Switching over to Postgresql for a Ruby on Rails application on a Windows machine is pretty simple.

Download Postgresql and install it
Install postgres-pr in the Ruby console with: gem install postgres-pr
Add Postgresql’s /bin path to your PATH environment variable in Windows. Do this by going to:
Start->Control Panel->System->Advanced->Environment Variables->Select PATH->Click Edit
Add the full path to the Postgresql [...]

Parsing Full RSS Content Text in Ruby on Rails

I was parsing an RSS file in Ruby on Rails today, and found that the RSS::Parser.parse seems to throw away the actual content of the RSS items, leaving only the description.
require 'rss'
require 'open-uri'

source = "http://www.website.com/rss.xml"
content = ""
open(source) do |s| content = s.read end
rss = RSS::Parser.parse(content, true)

rss.items.each do |item|
puts item.description
end
This didn’t do me [...]