Hi
I have no idea why I am having problems with something so simple but this condition statement is just not working.
@battalion = Battalion.find(params[:id])
@soldier = @battalion.soldiers(:conditions => ["seniorleader = ?", "No"])
This shows the array of Soldiers but doesn't reflect the condition I have set.
I am sure I am doing...
How can I use paperclip to move files uploaded using ftp to a server, create thumbnails and then move it all to aws?
Using paperclip as part of an upload process is no problem, and moving the files to aws as part of that process is also no big problem, but how can I use paperclip as part of something running entirely using cron and rake...
I am looking for an example of how to create a custom form builder for a radio button list bound to an object that acts_as_tree. I already have the code that displays the radio button list but want to DRY it up by refactoring into a formbuilder. I can't find any examples of a custom form builder for radio button lists.
Any pointers/li...
Hello,
I have this problem when I try to use "script/generate":
$ script/generate start
/Users/gst/.gem/ruby/1.8/gems/hpricot-0.8.1/lib/fast_xs.bundle: [BUG] Bus Error
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10]
Abort trap
I am using Snow Leopard on my 32-bit MacBook Pro. Just installed it.
I already tried to reinstall Ru...
Using Delayed Jobs on Heroku. How would I (easily) monitor the results of this worker? Should I simply activate a Mailer that sends me an email (might get burdensome as it runs each minute).
...
I'm using GMail to send out emails from a Rails app on Heroku. I'd like to integrate ActionMailer with Delayed Jobs, so that each email I want to send gets put into a queue that is handled asynchronously. Does anyone have an example/tutorial on this? Seems like a common enough feature, but having a hard time finding something.
...
In an 'index' method I'm always listing Objects. What is the best practice of handling sorting for this? So in the view I'd want a dropdown that lets me select by [Created At, Size, Price, ...]. An example would be much much appreciated.
...
I start feeling old fashioned when I see all these SQL generating database abstraction layers and all those ORMs out there, although I am far from being old. I understand the need for them, but their use spreads to places they normally don't belong to.
I firmly believe that using database abstraction layers for SQL generation is not the...
I'm aware that Rails has a few different levels for logging, but how can I only log the things I want it to, or rather, I only want things in my log that I specify with logger.debug
Is it possible to create my own logging level?
Also (last part of my question I swear) it seems that when Rails is in development mode, it ignores my logg...
I'd like to create a callback function in rails that executes after a model is saved.
I have this model, Claim that has a attribute 'status' which changes depending on the state of the claim, possible values are pending, endorsed, approved, rejected
The database has 'state' with the default value of 'pending'.
I'd like to perform cert...
Hey Everyone,
Our initial page load is a beast in our Rails app. The great thing about it is the lack of page refreshes needed. The whole thing is very Ajax-y (and our designers made it look great!) There is only one problem: Initial page load is a monster.
I have tweaked and prodded and have eeked out incredible speed improvements b...
What's the best way to implement ActiveRecord's find() and save() methods for an ActiveMerchant ActiveMerchant::Billing::CreditCard object in a Ruby on Rails application?
I'd like my credit card objects to inherit from ActiveRecord and ActiveMerchant.
Caveat: I understand that saving credit card information to a database is always con...
Im using a link_to_function / insert_html to insert a partial into the page. Everything works fine, until i add another link_to_function / insert_html into the partial that is being rendered into the page. All of a sudden the outer link_to_function link stops working and throws this error:
"missing } after property list" [Break
on ...
I'm building a Rails web app and was wondering what is the best way to get a list of products that Amazon would return based on a search term?
For example, if I sent amazon the term "iphone", I'd get a list of iphones back from Amazon.
Does anyone know if there's a gem or library for Rails out there that would fit this need?
...
I have a tables Foo and Bar. Foo has one Bar. When I query Foo, how can I order it by a date column in the Bar table?
Thanks
...
I'm not sure how to set permissions for Passenger on OSX. I have gotten through the install fine, but I understand now that Passenger runs as whoever owns environment.rb. That's my own user and group, call it apple & apple. As I understand it, Apache runs as _www & _www. What's the right strategy here? Let's say the app is at
/Users/app...
I am reading "Agile Web Development with Rails, 3rd Edition" and confusing about session-cookie.
On page 474 it has a topic about cookie detection and they talk how to handler cookie-disabled user. And they come up with cookie session idea which from my understanding is a fake session that act as a cookie right ?
What I don’t understan...
I'm getting error:
uninitialized constant ActionView::Helpers::JavaScriptElementProxy::ActionView
I've tried forcing a reinstall of jrails which didn't fix the error, and Googling the error has yet to yeild a result. Any suggestions? Ruby 1.9.1, Rails 2.3.4.
...
I have a hash which has in excess of a thousand key/value pairs.
I have a database table with several thousand rows.
So to brute-force an update of the table based on the hash is pretty simple. e.g. :
my_hash.each{|key,value|
Model.update_all("column2 = #{value}", "column1 = #{key}")
}
But this will do over a thousand SQL update ...
For a new application I want to start dabbling in BDD and I'm trying to decide between using RSpec or Thoughtbot's Shoulda. I like the macros that Shoulda uses, and the fact that it doesn't seem to reinvent the way Ruby/Rails does testing, but simply provides an add-on. On the other hand, the macros seem like a bit too much "magic" ins...