How to find a record created on the previous month?
I have a table where new records are added daily. How would I go about finding records created in the previous month? ...
I have a table where new records are added daily. How would I go about finding records created in the previous month? ...
Here I have the start of a news posting app I'm working on in ruby. Creating an article works fine, but I'm lost as to how to retrieve one. I'd like my Article.get method to return an article object,.. but it seems the only way to do this is to make all the Article attributes writable, which I don't really want to do. Are there any bette...
Is there a way to access everything in the symbol table in Ruby? I want to be able to serialize or otherwise save the current state of a run of a program. To do this, it seems I need to be able to iterate over all the variables in scope. ...
I have used PHP for awhile now and have used it well with CodeIgniter, which is a great framework. I am starting on a new personal project and last time I was considering what to use (PHP vs ROR) I used PHP because of the scalability problems I heard ROR had, especially after reading what the Twitter devs had to say about it. Is scalabil...
I'd like to know situations in which I should consider using a framework other than Rails. ...
I am concerned whether Rails can handle the types of complex aggregations that are needed for a financial application and particularly whether the ORM can handle these effectively. In a financial application that I am thinking of using this for, there is a need to do lots of reporting of detailed financial data, aggregated in various way...
Hello. I've inherited a Ruby on Rails application that has a problem. I'm half way through some books on Rails, but haven't seen the answer to some questions yet. What is the best way to backup the application? Can I just tar -cvzf app.tgz app? I don't know yet if the app has a sqlite3 database or connects to a db server. What's the b...
How can I create an array of email addresses contained within a block of text? I've tried addrs = text.scan(/ .+?@.+? /).map{|e| e[1...-1]} but (not surprisingly) it doesn't work reliably. ...
So what are your favorite Ruby or Ruby on Rails blogs? One link per post please and short description would be nice. ...
I decided to learn Ruby, and I wanted to ask what sort of things you felt Ruby did better than other languages, facilities it has, and the position of the language in the industry today, amongst other languages, is it a strong competitor? What target audience is it aimed at, web-developers/GUI-programmers/10 line scripters? Kindly give m...
I was just reading up on ROR (haven't dived into it yet), and I hear that it isn't thread safe. Obviously, this doesn't mean that more than one person can't access your site at one time, so what exactly does it mean? Where do threads come into play in ROR? Do they just mean the request handling? ...
Also, I'm wondering what effect upgrading to Ruby 1.9 would have on legacy code from version 1.86. Is the new version backwards compatible? ...
I have a form that makes an Ajax POST request to insert a widget into my database. In the form, I have a select box where you can select from the widgets. After the db insert is made, I must update the select box. I actually just replace the entire form for now. Because the select box has the widgets, I must have a copy of the obje...
I want to install a GC Patched Ruby to do a memory profiling on my app. I followed the instructions at http://guides.rubyonrails.org/performance_testing.html#gc and installed a ruby instance at my home dir (I already have another "official" instance for development). This GC Patched ruby instance is working fine. The problem is when I n...
The acts_as_ordered plugin isn't ordering records in my Ruby on Rails app. I have the following models quiz.rb class Quiz < ActiveRecord::Base acts_as_ordered :order => 'created_at DESC' validates_presence_of :name, :user_id belongs_to :user has_many :questions before_destroy :delete_questions end question.rb class Ques...
Hi, I'm looking for a Rake task to do deployment via FTP. Does anyone know of any? Anders ...
I'm parsing a tab-delimited file using FasterCSV: csv_rows = FasterCSV.readlines(file_location, {:col_sep=>"\t"}) When I parse this I get an 'Illegal quoting on line 1.' error. The line contains this text: ...around \"foo bar\" with... Is there another way to escape quotes that might work? Thanks, ...
Full disclosure: I'm very new to Ruby. The following code seems like it should update the para's text with the app's current dimensions as you resize it. Shoes.app do stack do @para = para end animate 1 do @para.text = "%d x %d" % [ app.width, app.height] end end But it never changes. I ...
Is it possible to get rid of the eval statement below? The code below filters out all classes which are derived from type BaseClass. Afterwards those classes are instantiated and method 'hello' is called. module MySpace class BaseClass def hello; print "\nhello world"; end end class A<BaseClass def hello; super; print ",...
Sending an email is usually called after an action on a model, but the email itself is a view operation. I'm looking for how you think about what question(s) to ask yourself to determine where to put the action mailer method call. I've seen/used them: In a model method - bad coupling of related but seperate concerns? In a callback i...