I just started looking into OAuth and it looks really nice. I have oauth with twitter working in ruby right now.
Now I'm wondering, what is the recommended safe way to store the responses in my local database and session?
What should I store?
Where should I store it?
This example twitter-oauth-with-rails app stores a user.id in the...
I am trying to write to a single file from multiple threads. The problem I'm running into is that I don't see anything being written to the file until the program exits.
...
I'm very new to Ruby (and OOP as well) and I don't know why the following thing doesn't work in Ruby
I extended the String class with a new method. Easy enough. Now I want to extend the Fixnum class. A String object appears somewhere in the class, but I can't use the method that I defined earlier. Why? Is this normal?
This is the new m...
I setup the proper SDK because all my ruby code will compile but RubyMine complains that
it can't find the any of my java classes? Is this a flaw or is there a way to get it to recognizewhere the classes are?
Here is my code, I have underlined all the things its complaining about
require 'java'
include_class 'java.awt.event.ActionList...
I have a Ruby-on-Rails model:
class Candidate < ActiveRecord::Base
validates_presence_of :application_essay
validate :validate_length_of_application_essay
protected
def validate_length_of_application_essay
return if application_essay.blank? # don't add a second error message if they didn't fill it out
errors.add(:appli...
I'm trying to make an image scale inside of a QGraphicsView and having zero success. I did find this C++ question with what seemed to be the same problem:http://stackoverflow.com/questions/2489754/qgraphicsview-scrolling-and-image-scaling-cropping
I borrowed the approach of overriding the drawback/foreground. However when I run the scr...
Hello, I am building an application that requires a search to go deeper than the initial level. I am using nested scopes to accomplish this and params in the URL
For example, when a user searches for "handbag" it creates a query like the following.
http://localhost:3000/junks?search=handbag&condition=&category=&main_submit=...
I have a model that would look something like:
my_diet = Diet.new
my_diet.food_type_1 = "beef"
my_diet.food_type_1_percentage = 40
my_diet.food_type_2 = "carrots"
my_diet.food_type_2_percentage = 50
my_diet.food_type_3 = "beans"
my_diet.food_type_3_percentage = 5
my_diet.food_type_4 = "chicken"
my_diet.food_type_4_percentage = 5
I nee...
The following question is related to the question "Ruby Print Inject Do Syntax". My question is, can we insist on using do and end and make it work with puts or p?
This works:
a = [1,2,3,4]
b = a.inject do |sum, x|
sum + x
end
puts b # prints out 10
so, is it correct to say, inject is an instance method of the Array object, and ...
I'm trying to install Community Engine using the instructions here: http://github.com/bborn/communityengine
At first I thought it might be because I had Rails 2.3.5 and desert 0.5.3 which were higher versions than what was mentioned on the installation site. However moving to rails 2.3.4 and desert 0.5.2 did not work.
Any ideas as to ...
Hi!
I have got model Team and I've got (i.e.) team = Team.first :offset => 20. Now I need to get number of position of my team in db table.
I can do it in ruby:
Team.all.index team #=> 20
But I am sure that I can write it on SQL and it will be less expensive for me with big tables.
...
From time-to-time I get this when a breakpoint is triggered. It looks like stack frames aren't getting saved so I can't step back through the call stack - a real pain. See below for an example
--> #0 BatchProcess.add_failure_record(row_id#Fixnum, test#Struct::Test, message#String,...)
at line server/processes/batch.rb:309
Warnin...
I have an Rails application with SayController, hello action and view template say/hello.html.erb. When I add some cyrillic character like "ю", I get an error:
ArgumentError in SayController#hello
invalid byte sequence in UTF-8
Headers:
{"Cache-Control"=>"no-cache",
"X-Runtime"=>"11",
"Content-Type"=>"text/html; charset=utf-8"}
...
When starting the server, I get this strange error after updating to Ruby 1.9:
"
[BUG] cross-thread violation on rb_gc()
ruby 1.8.6 (2008-08-11) [i386-mswin32]
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
"
My mongrel version is 1.1.6,...
Hello,
What i'm trying to achieve here is lets say we have two example urls:
url1 "http://emy.dod.com/kaskaa/dkaiad/amaa//////////" & url2 = "http://www.example.com/".
How can I extract the striped down urls?
url1 : "http://emy.dod.com/kaskaa/dkaiad/amaa" & url2 to "http://http://www.example.com"?
URI.parse in ruby sanitizes certa...
This is what I've got, but it also finds classes and other constants.. is there a better way?
class Module
def children
constants.collect { |c| const_get(c) }.compact
end
end
...
The default Ruby wordfile in UltraEdit does not support code folding. Is there a Ruby wordfile for UltraEdit that does support code folding?
...
I'm attempting to reopen the String class in rails and add a bunch more methods for my app to use. Writing the code isn't a problem - my question is rather about where this code should go.
It doesn't make sense to me to reopen a class inside a different model file, because it really has nothing to do with any of the models specifically....
What Emacs feature(s), packages, add-ons, etc. helps you in your daily Ruby On Rails development?
...
This is my first time trying to set up capistrano to deploy a rails application. I am deploying from my local machine to my remote server that has the repo, web, app, and mysql servers all on the same machine. I am following this walk through: http://www.capify.org/index.php/From_The_Beginning
I get to the command
cap deploy:start
Th...