In my database, I have a model which has a field which should be selected from one of a list of options. As an example, consider a model which needs to store a measurement, such as 5ft or 13cm or 12.24m3. The obvious way to achieve this is to have a decimal field and then some other field to store the unit of measurement.
So what is th...
I have been dabbling with Ruby for some time now and also was thinking of learning RoR they released a new version for it. :)
So now should I start learning RoR v1.2 or v2.x especially keeping the following in mind
I couldn't find any great free books/in-depth tutorials on RoR 2.x yet
I want to learn RoR with the eventual goal of doin...
I would like to confirm that the following analysis is correct:
I am building a web app in RoR. I have a data structure for my postgres db designed (around 70 tables; this design may need changes and additions during development to reflect Rails ways of doing things. EG, I designed some user and role tables - but if it makes sense to us...
Yesterday, I asked this question and never really got an answer I was really happy with. I really would like to know how to generate a list of N unique random numbers using a functional language such as Ruby without having to be extremely imperative in style.
Since I didn't see anything I really liked, I've written the solution I was lo...
Ruby's standard popen3 module does not work on Windows. Is there a maintained replacement that allows for separating stdin, stdout, and stderr?
...
I have several properties that are dependent on the environment the application is running. For example, there are links to another application that is being developed concurrantly that get displayed in the header and footer. I want those links to be different depending on what environment they are in.
This is slightly different than t...
I'm implementing charts using The Ziya Charts Gem. Unfortunately, the documentation isn't really helpful or I haven't had enough coffee to figure out theming. I know I can set a theme using
chart.add(:theme, 'whatever')
Problem: I haven't found any predefined themes, nor have I found a reference to the required format.
...
If a callback handler returns false, does it cause only the handlers for that callback to not be called, or does it cause the remaining callbacks in that handler and all subsequent callbacks to not be called as well?
...
On destruction of a restful resource, I want to guarantee a few things before I allow a destroy operation to continue? Basically, I want the ability to stop the destroy operation if I note that doing so would place the database in a invalid state? There are no validation callbacks on a destroy operation, so how does one "validate" whethe...
What's your favourite IRB tip or trick? It could be a handy shortcut within the IRB console itself or maybe a .irbrc customization.
I really like that you can type an underscore to retrieve the result of the last expression.
...
I recently converted a ruby library to a gem, which seemed to break the command line usability
Worked fine as a library
$ ruby -r foobar -e 'p FooBar.question' # => "answer"
And as a gem, irb knows how to require a gem from command-line switches
$ irb -rubygems -r foobar
irb(main):001:0> FooBar.question # => "answer"
But the...
I'd like to slice and dice large datafiles, up to a gig, in a fairly quick and efficient manner. If I use something like UNIX's "CUT", it's extremely fast, even in a CYGWIN environment.
I've tried developing and benchmarking various Ruby scripts to process these files, and always end up with glacial results.
What would you do in Ru...
I'm tired of using:
tail -f development.log
To keep track of my rails logs. Instead I would like something that displays the info in a grid and allows my to sort, filter and look at stack traces per log message.
Does anyone know of a GUI tool for displaying rails logs. Ideally I would like a standalone app (not something in Netbeans...
Let's say that I have a widget that displays summary information about how many posts or comments that I have on a site.
What's the cleanest way to persist this information across controllers?
Including the instance variables in the application controller seems like a bad idea. Having a before filter that loads the data for each contr...
Please share the link to ONE Ruby tutorial that you think deserves the title. If you have information about the intended target audience's skills, please include it in your answer as well. This will help readers choose an appropriate tutorial.
...
Is it the case that the entire restful verb is under a single all encompassing transaction? That is to say, if I raise a Error in the validation or callbacks at any point in the handling of a UPDATE, DELETE, or CREATE operation, is every database operation that I may have performed in previous callbacks also rolled back? Succinctly, does...
Trying to find the sqlserver adapter for rails on windows.
I have tried getting it from (without luck):
gem install activerecord-sqlserver-adapter --source=http://gems.rubyonrails.org
Where else can I get this gem?
UPDATE:
Make sure to run the command prompt as the administrator. Right click on the command prompt and click "Run as a...
Say I have an array that represents a set of points:
x = [2, 5, 8, 33, 58]
How do I generate an array of all the pairwise distances?
Thanks!
...
I'm trying to write an app using Ruby on Rails and I'm trying to achieve the following:
The app needs to receive UDP messages coming in on a specific port (possibly 1 or more per second) and store them in the database so that the rest of my Rails app can access it.
I was thinking of writing a separate daemon that would receive th...
Using Rails v2.1, lets say you have an action for a controller that is accessible from more than one location. For example, within the Rails app, you have a link to edit a user from two different views, one on the users index view, and another from another view (lets say from the nav bar on every page).
I'm wondering what is the best w...