I'm using Nokogiri to grab the contents of the title tag on a webpage, but am having trouble with accented characters. What's the best way to deal with these? Here's what I'm doing:
require 'open-uri'
require 'nokogiri'
doc = Nokogiri::HTML(open(link))
title = doc.at_css("title")
At this point, the title looks like this:
Rag\30...
Hello SO.
I'm trying to make an API for my rails application using JSON responses to RESTful resource controllers. This is a new experience for me, so I'm looking for some guidance and pointers. To start things off:
In a rails application, what is the "proper" way to respond with JSON to REST-ful controller methods? (create, update, d...
Hi i'm doing a fb app that update the status box(what's in your mind), i'm using set_status from facebooker .. first i have this error:
set_status needs extended permission
so i google it and find this: before_filter :ensure_has_status_update .. so i put it in my controller and that solves the problem, but when i try to update the st...
I'm trying to figure out how to get rmagick on my app, and then make it work on Heroku?
...
Hello, I'm new to Ruby on Rails (I know Ruby just decently though) and looking at the Migration tools, it sounds really awesome. Database schemas can finally (easily) go in source control.
Now my problem with it. When using Postgres as the database, it does not setup foreign keys. I would like the benefits of foreign keys in my schema ...
My problem is that I try to upload an image and some text values to an rails server, and the text values end up as files, insted of just param values.
How the post looks on the server
Parameters: {"action"=>"create", "controller"=>"problems",
"problem"=>{"lon"=>#File:/tmp/RackMultipart20100404-598-8pi1vj-0>,
"photos_attributes"=>{"0"=...
I have a static_controller that is in charge of all the static pages in the site and works as follows in routes.rb:
map.connect ':id', :controller => 'static', :action => 'show'
I have a static page called about that among other information, has a contact form.
I currently have a contacts_controller that is in charge of inserting the ...
Disclaimer: I have not used RoR, and I have not generated tests. But, I will still dare to post this question.
Quality Assurance is theoretically impossible to get 100% right in general (Undecidable problem ;), and it is hard in practice.
So many developers do not understand that writing good automated tests is an art, and it is hard.
...
I'm trying to send some XML to a rails app in Flex. I'm using the URLRequest and URLLoader objects. However, I'm having trouble determining how to send the XML and _method parameter to the rails app using these flash objects. Below is how I'm currently trying to achieve this.
var request:URLRequest = new URLRequest();
re...
I want to let users create "apps" (like Facebook apps) for my website, and I'm trying to figure out the best way to make it secure.
I have a REST api
i want to run the user apps in an iframe on my own site (not a safe markup language like FBML)
I was first looking at oAuth but this seems overkill for my solution. The "apps" don't ne...
I have a create action for a form that potentially generates errors (i.e. first name is missing) and then redirects.
The problem is, that when the redirect happens those form errors get lost.
How could I pass those form errors in a session to be displayed back in the original form (which should still be filled out with the previous deta...
Does anybody know of a plug-and-play login system that supports existing logins like Google and OpenID?
I am looking to implement something similar to that of Stack Overflows.
Thanks!
RPX is indeed what I was looking for. Are there any other systems like RPX that do a similar thing?
...
I'm sending a byte array to a piece of hardware.
The first 7 bytes contain data and the 8th byte is a checksum.
The 8th byte is the Least Significant Byte of the sum of the first 7 bytes.
Examples that include the correct checksum. The last byte of each of these is the checksum
200-30-7-5-1-2-0-245
42-0-0-1-176-0-148-39
42-0-0-3-17...
I have an object which whether validation happens or not should depend on a boolean, or in another way, validation is optional. I haven't found a clean way to do it. What I'm currently doing is this (disclaimer: you cannot unsee, leave this page if you are too sensitive):
def valid?
if perform_validation
super
else
super ...
Hi,
I have a store model that has many products with a has_many :through relationship.
I have this working with accepts_nested_attributes, but the result is that rails is making duplicate associates.
I don't have anything special going on it is a very simple app.
Any ideas on why duplicates associates are getting created?
...
Who can show me how I must use declarative_authorization (http://github.com/stffn/declarative_authorization) with restfult_authentication (http://github.com/technoweenie/restful-authentication)?
...
I'm trying to create an accessor for one element from array with specific flag set to true:
class EntranceObject < ActiveRecord::Base
has_many :subscribers
def customer
self.subscribers.find(:first, :conditions => {:is_customer => true})
end
def customer=(customer_params)
self.subscribers << Subscriber.new(:name => c...
Here's a simple migration I'd like to run :
class AddTimeOfRevisionToBrandWikis < ActiveRecord::Migration
def self.up
add_column :brand_wikis, :time_of_revision, :datetime
end
def self.down
remove_column :brand_wikis, :time_of_revision
end
end
Here's what I get when I try to run it :
$ rake db:migrate
(in /Users/koua...
Has accept_nested_attributes_for already works with Rails 2.3.5 and Ruby 1.9.1????
I keep getting this error
undefined method accept_nested_attributes_for' for #<Class:0x00000108da2140>
...
I am currently using a site5 server and would like
rake jobs:work pretty much running all the time.
I currently cannot send out the jobs unless i'm logged into the server. I hope that someone out there can help me with this. Had alot of trouble with ar_mailer and the whenever gem ... but have about another 5 gems working perfectly withi...