In my current Ruby on Rails view we have many views and partials. So many in fact that it's not clear which view uses which partial (which itself may use other partials as well).
The question is if there's a tool out there that generates a dependency graph of all views and partials (ideally generating a graph, but that's easy to do) or ...
I have a fairly intensive algorithm that must be run pretty often (many times per second) in my RoR application. Considering how slow Ruby is with this kind of stuff, I don't think it would be good to do the work in Ruby.
You may be thinking I should add it to a work queue of some sort and have a C++ app work it down, but I need the res...
Which style is preferred?
Is there a good reason for one vs. the other?
Thanks in advance!
1) cmds.each do |cmd|
end
2) cmds.each { |cmd|
}
Example code:
cmds = [ "create", "update", "list", "help" ]
# Block style one
#
cmds.each do |cmd|
puts "loop1, cmd: #{cmd}"
end
# Block style two
#
cmds.each { |cmd|
puts "loop2, c...
Given the following two (simplified) models:
class Customer < ActiveRecord::Base
# finder sql to include global users in the association
has_many :users, :dependent => :destroy,
:finder_sql => 'SELECT `u`.* FROM `users` `u`
WHERE (`u`.`customer_id` = "#{id}" OR `u`.`customer_id` IS NULL)'
validates_presence_of :name
end
clas...
This is using Rails 2.2.2
I have a model that uses the acts_as_flaggable plugin, and on the page I use to display an instance of the model, I list any flags that the model has.
When I start my Rails dev server(mongrel) using the standard script/server command, load the page holding the following code, it loads fine:
<% @object.flags.e...
I know you Ruby people will laugh at my bad Ruby code:
i=0
for blah in blahs
puts i.to_s + " " + blah
i+=1
end
I want to use a for-each and a counter... is there a better way to do it?
Note: I don't know if blahs is an array or a hash, but having to do blahs[i] wouldn't make it much sexier. Also I'd like to know how to write ...
Is it possible to invoke a method when the initial state is entered when using the AASM Gem? I'd like the spam_check method to get called when a comment is submitted, but it doesn't seem to work.
class Comment < ActiveRecord::Base
include AASM
aasm_column :state
aasm_initial_state :submitted
aasm_state :submitted, :enter => :sp...
I'm looking for a Rails plugin that eases the development of a "friends" system or social networking system for the latest versions of Ruby on Rails.
Before anyone says it...I know, I should probably create it myself, from scratch. And I am fully capable of this (I think). I'm just looking for a good plugin that can a.) make life a bit ...
I would like to know what are ruby's alternatives to the Java methods :
wait
notify
notifyAll
Could you please post a small snippet or some links ?
...
Hi, I'm new to Rails and I'm aware it has things such as unit-testing built in. But I'm interested in doing some more simple tests that are equivalent to your "printf" in C. So I'm testing a login page I've written and want to trace the code to see what each line like my find methods are returning. I try outputting with "puts" but I don'...
Does anyone know what the regular expression in Ruby is to verify an email address is in proper RFC 2822 email format?
What I want to do is:
string.match(RFC_2822_REGEX)
where "RFC_2822_REGEX" is the regular expression to verify if my string is in valid RFC 2882 form.
...
STILL NOT RESOLVED :( [Feb 11th]
I have a large text file full of random data and want to pull out all the email addresses from it.
I would like to do this in Ruby, with pseudo code like this:
monster_data_string = "asfsfsdfsdfsf sfda **[email protected]** sdfdsf"
monster_data_string.match(EMAIL_REGEX)
Does anyone know what Ruby e...
Hello, I need to be able to determine a systems maximum integer in Ruby. Anybody know how, or if it's possible?
...
I write automated test with Ruby(Selenium framework) and I need to know how can I select an option from drop-down list.
Thanks in advance!
...
For those who haven't used DrScheme, window is split in two parts: one part is a file you're editing, and the other is interactive shell. When I run a file, it is loaded into interactive environment, so I can invoke functions I've defined etc. Interactive environment still has all the features of text editor (syntax highlighting, auto co...
I'm currently working on a largish Ruby on Rails project. It's old enough and big enough that it's not clear if all views are actually in use.
Is there any script/plugin out there that can generate a list of unused view files?
...
Hi there,
I have a page that will list news articles. To cut down on the page's length, I only want to display a teaser (the first 200 words / 600 letters of the article) and then display a "more..." link, that, when clicked, will expand the rest of the article in a jQuery/Javascript way. Now, I've all that figured out and even found th...
Scenario:
I load some data into a local MySQL database each day, about 2 million rows;
I have to (have to - it's an audit/regulatory thing) move to a "properly" administered server, which currently looks to be Oracle 10g;
The server is in a different country: a network round-trip current takes 60-70 ms;
Input is a CSV file in a denorma...
Does Ruby have block comments?
If not, is there an efficient way of inserting # in front of a block of highlighted code in TextMate?
...
There exists the multisite plugin (http://github.com/dasil003/rails-multisite/tree/master) that allows for multiple view folders based on different sites. It especially allows you to only overwrite certain views in a site and leave the others untouched (i.e. the other views don't exist twice).
Does something like this exist for ActionMa...