the following is my dropdown to select chat rooms:
<% form_for :chat_room do |form| %>
<%= form.select(:title, @chat_rooms.collect! {|x| x.title},{:include_blank =>'select a chat room'}) %>
<% end %>
My routes are:
ActionController::Routing::Routes.draw do |map|
map.resource :account, :controller => "users"
map...
I'm using AASM by Rubyist to build a 4-step wizard for an AR object. According to the state of the object, there are different validations that need to be done. What is the smartest way to validate an object according to it's state on a certain transition?
...
What message queues are people using for their Rails apps and what was the driving force behind the decision to choose it. Does the latest Twitter publicity over their in house queue Starling falling down affect any existing design decisions.
I am working on an app that will need a message queue to process some background tasks, I haven...
I'm trying to use optparse to parse command line arguments. I would like my program to accept arguments like that:
$ ./myscript.rb [options] filename
I can easily manage the [options] part:
require 'optparse'
options = { :verbose => false, :type => :html }
opts = OptionParser.new do |opts|
opts.on('-v', '--verbose') do
option...
Hi,
I have this:
SectionHistory.find(:all, :conditions => ["id=? and (name!=? or code!=?)", sec.id, sec.name, sec.code])
And I get the error "The character "!" following "and (name!=? or code" is not valid"
if my condition string is just "id=? and (name!=?)" it's OK
We're using DB2.
Any suggestions on this?
Thanks
...
I looked around the documentation but found nothing - is there a way to make a Shoes app display full screen?
Possibly something like..
Shoes.app :fullscreen => true do
para "test"
end
Looking in the source-code, the following lines mentioning "fullscreen" (among others):
shoes/app.c:58: app->fullscreen = FALSE;
shoes/native/coco...
I'm setting up a SaaS style website wherein I will have multiple clients all managing their workflows and data on the same site -- and thus the same database.
I'm not even sure if there is a word for this concept, but is there any established way of auto-segregating the data so that any ActiveRecord calls to the database are filtered/re...
I'm new to VB .NET, and if possible, I'd like something like Rails partials - bits of HTML template that can be referenced in a page's script, possibly within a loop. I know there might not be anything like that.
...
My application is in RoR
I have an action/view called showsummary where the ID has been passed into the URL, and the controller has used that to instantiate @vendor where @vendor.name is the name of a company.
I would like the URL to be, rather than showsummary/1/ to have /vendor-name in the URL instead.
How do I do that?
...
My app has a select box for users to choose a "venue". This select box is, as you would expect, in a form. I also have an action somewhere on the page that creates a new venue via AJAX. After the new venue is created, I would like to updated the venue select box to reflect this.
My solution was to put the select box in a partial and ...
Hi,
I am writting a rake task that would connect to a legacy ORACLE database, get some 'issues' records from a helpdesk application, apply some transformation and store it in another database (Redmine).
The problem is that even though the script runs smoothly on Windows, it fails to run on RHEL 5. The library files are all installed ...
Ok, so I would like to create an action in Rails to restart itself. I did a little searching and found:
http://snippets.dzone.com/posts/show/5002
Which suggests 2 commands, one to stop and another to restart. The following kills:
ps -a|grep "/usr/local/bin/ruby script/server"|grep -v "grep /usr"|cut -d " " -f1|xargs -n 1 kill -KILL ...
I'm planning on running a ruby process that may take a month to finish. If possible, I'd like to ensure that a blackout or hitting the wrong button won't cost me the whole month's work.
Is there an easy way to periodically save the program's state to disk? (Techniques that involve more effort would include adding code that marshals eve...
Dear all
In simple terms, what does Rake do? What purposes does it have? I understand it's a build tool but I'm looking a bit more detail. (For a simpleton.)
Many thanks
Skipz
...
I have problem in my model. I want method to use another property of model but before using it I want another method to be executed (to make property have value). Here is an example:
def medthod_one=(val)
self.value = val
end
def method_two
self.second_value = self.value / 2 #just for example
end
So, in my case self.second_...
Hi there i want to display an error message if the session is closed, cause if i log in and and i press the go back at the top of the browser and then press the go forward and try to refresh the page it display an error message that it couldn't find the current user who was in the session and i want to display a page for handling that er...
When writing the "create" method for an object in a Ruby on Rails app, I have used two methods. I would like to use one method for the sake of cleaner and more consistent code. I will list the two methods below. Does anyone know if one is better than the other? If so, why?
Method 1:
def create1
# is this unsecure? should we grab ...
I am currently porting a self-written network application from C++ to Ruby. This network application often needs to manage around 10.000 sockets at the same time, that means it needs quick access to any sockets that have readable data available, incoming connections, etc.
I have already experienced while writing it in C++, that select()...
What's the best way to achieve Rails-like flash messages such as "Update successful" http://api.rubyonrails.org/classes/ActionController/Flash.html) in the Java world? I'm using Spring MVC.
...
I'm trying to programatically create beautiful thumbnail images of a large number of web pages that are hosted on my own ruby/rails-based website.
I want to be able to code a stand-alone bit of ruby that looks something like this:
require 'awesome-screenshot-maker'
items.each do |id|
url = "http://foo.com/bar/#{id}"
shooter = Awes...