In situation, when I need a webservice client, which will be used by some action controllers, how should it be implemented? As it will have some constant values (addres, parameters names) and session key, refreshed every 30 minutes, I guess model stored in database isn't the best solution. What is the best practice?
...
We are working on a service that will have website access for stats and other tasks, but the majority of use will be through a client gem and rake tasks. What is the best way to handle authentication for both pieces.
It looks like fiveruns_tuneup, getexceptional, New Relic and others have websites with username and pass, but use API key...
I'm really struggling with grasping how to effectively use FasterCSV to accomplish what I want.
I have a CSV file; say:
ID,day,site
test,tuesday,cnn.com
bozo,friday,fark.com
god,monday,xkcd.com
test,saturday,whatever.com
I what to go through this file and end up with a hash that has a counter for how many times the first column occur...
In ruby, is there a way to "undefine" a variable or constant once it's been defined?
In our rails environemnts, we define one of three contants to be true, depending on the environment: TESTING, DEVELOPMENT, or PRODUCTION. Then, in controller code, we use defined? to see if what environment we're in, ie: defined? PRODUCTION.
Now, I wa...
Following on from my question on using frozen Capistrano a couple of days back I'm still having issues running Capistrano frozen in my vendor folder.
When I try and run my frozen version of cap
ruby -r rubygems ./vendor/gems/capistrano-2.5.2/bin/cap deploy-with-migrations
I get an error
... RubyGem version error: net-ssh(1.0.8 not ...
Suppose you are implementing a publication database and creating migrations to represent different publications. Each publication has a "year" associated with it.
t.column :year, ???
Would this year be best represented as an integer, date, or datetime?
...
I have a selection of relatives that want to buy me Christmas presents, sadly I can think of only 3 things that I really need (I'm a pretty content person).
However, it occurred to me that I want to learn Ruby a little at some point and getting a Dead tree version of a Ruby book would be useful for that.
As such I'm looking for suggest...
When possible.. do you leave parentheses in or out in Ruby?
...
I'm an email n00b but I am working on an application that sends HTML email with Unicode characters (as my friend noted "enjoy encoding hell").
The Subject: header comes from user input and therefore may contain Unicode characters. Some mail clients (like GMail and Outlook 2007) are OK with this, but from my reading it seems the right wa...
I see the following code in the attribute_fu plugin:
module AttributeFu
module Associations #:nodoc:
def self.included(base) #:nodoc: ...
Linux 2.6.18-92.el5, ruby 1.8.7, Rails 2.2.2, mysql gem 2.7
I installed the MySQL binary distribution under /usr/local, then installed the mysql gem like this:
gem install mysql --no-rdoc --no-ri \
-- --with-mysql-include=/usr/local/mysql/include \
--with-mysql-lib=/usr/local/mysql/lib \
--with-mysql-config=/usr/local/mysql/bin/m...
I am working on a rails application (I have some experience with rails). But, this time I am using RESTful to build it. I am wondering how do I validate my models in a RESTful fashion? What I mean by that is when a user enters data into a form, but the model validations prevent the model from being created what is a RESTful way to red...
In Ruby you can reference variables inside strings and they are interpolated at runtime.
For example if you declare a variable `foo' equals "Ted" and you declare a string "Hello, #{foo}" it interpolates to "Hello, Ted".
I've not been able to figure out how to perform the magic "#{}" interpolation on data read from a file.
In pse...
Is it possible to use something like:
require 'serialport.o'
with Shoes? serialport.o is compiled c code as a ruby extension.
When I attempt to run the following code in shoes, I see no visible output to the screen and shoes crashes on OS X.
Thank you
CODE:
require "serialport.o"
port = "/dev/tty.usbserial-A1001O0o"
sp = Serial...
I'd like to be able to send a Ruby app to some colleagues without requiring them to install a Ruby interpreter. A single exe would be preferable.
I googled and found "RubyScript2Exe".
What are your experiences with that? Are there other such tools or are there better approaches altogether than building an exe?
...
Hi,
I have a string, lets say "123|ABC|test|12345|FF" and I want to xor the ascii value of each character and print the result in hex.
What is the simplest way?
...
I'm looking to implement a state machine to manage a user moving through a series of steps over an extended period of time (weeks) with emails and then they interact with the app. I've looked at a couple of AASM plugins and forks (it seems like this plugin space has become a bit chaotic) and am curious what people would recommend.
I sa...
My homepage (or welcome page) will consist of data from two models (lets call them authors and posts). I am new to rails and not sure what is the best way to accomplish this.
Should I create a new controller called welcome which gathers data from the authors and posts and then display them in the welcome index view? Or should I have a w...
I've built a nice website system that caters to the needs of a small niche market. I've been selling these websites over the last year by deploying copies of the software using Capistrano to my web server.
It occurs to me that the only difference in these websites is the database, the CSS file, and a small set of images used for the ind...
Is the LAMP (Linux, Apache, MySQL, PHP / Ruby / Python) stack appropriate for Enterprise use?
To be clear, by "Enterprise", I mean a large or very large company, where security, robustness, availability of skill sets, Total Cost of Ownership (TCO), scalability, and availability of tools are key considerations. Said another way, a compa...