Posts Tagged ‘ruby’

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]

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 [...]

Rails Auto-Clearing Input Field

At certain times you might want to have a form input field have a description or default value that automatically clears when the user clicks the field to enter text.
An example of this is Digg’s search box. By default, it reads, “Search Digg…”, but when you click it, the default text disappears and makes room [...]

Basic Search Form in Rails

If you want to add a simple search page to your rails application, you’ll probably want a form that uses GET rather than POST, since GET will allow your visitors to bookmark the results page, and won’t complain if the user decides to refresh the results page.
Also, you’ll want the form to simply update the [...]