Hi
In Rails 2.3.8 there is a class method ActiveRecord::Base.count_by_sql which allows to perform custom SELECT count(*) .... Is it save to execute customized SELECT sum(...) ... query with this method? If not, what should be done to execute such a query? Is ActiveRecord::Base.connection.execute the only option?
Thanks.
EDIT: Query I ...
My RoR app works fine when run locally, but when I run it on Heroku, it errors on this line:
my_reader = Docreader.new(params[:doc])
Error:
NameError (uninitialized constant NotesController::Docreader):
Docreader.rb is located in the lib folder
I've tried heroku restart, but it didn't help. What am I doing wrong? Thanks for readin...
What is the difference between having require 'gem_name' in a controller and config.gem "gem_name" in environments.rb? I'm new to RoR, and am looking through an app and can't work out the difference. Thanks for reading.
...
I have a daemon that should run behind my rails app doing db modifications.I implemented that daemon using ruby daemons gem. I want to start that daemon at the start of my app. Whenever my app starts, I need to start that daemon.
How can I do this..?
...
Applications have bugs or get bugs when updated, some hidden that they get detected months or years later, producing orphaned records, keys pointing nowhere etc. even with proper test suites.
Allthough Rails doesn't enforce referential integrity on the database level - and for some good reasons discussed elsewhere it will stay like that...
We've recently revamped a project, and are looking to bring all our old data into the new system. The problem is that the schema is marginally different, so a straight SQL import isn't possible. Due to some denormalization and database changes, we'll need to do some massaging of the data before it's ready for import. I was hoping for ...
Dear All,
What is the most secure way to achieve above? I want to edit apache VHOST file through my Rails application.
Thanks,
Imran
...
In Ruby, what is the best way to send a raw XML payload as the body of an HTTP POST request? i.e. without having to specify a parameter name to assign the XML contents
...
I've been banging my head at this one:
I have a table with columns start_time an end_time as well as start_date and end_date, and I have a Time object called test_time. I need to be able to match these values in a sql query. ie.
Reservation.find :all, :conditions =>
["'start_time' <= ? AND 'end_time' >=
?", test_time, test_time]...
Hello,
I am new to ruby on rails and I have just started watching rails casts tutorials.
I have understood on how to parse feeds using feedzirra if the feed is in English but if I have a feed like this which is in spanish then how do i parse this feed?
The link is
http://estaticos.marca.com/rss/futbol_equipos_almeria.xml
how do i co...
Hey fellow Rail-ists, do know any equivalent of ActiveScaffold but being ORM agnostic or at least for Mongoid?
...
Hello,
I am new to ruby on rails and I have just started watching rails casts tutorials.
To parse feeds, I have started using feed zirra.
To fetch multiple feeds at once, feedzirra has this feature
feed_urls = ["http://feeds.feedburner.com/PaulDixExplainsNothing",
"http://feeds.feedburner.com/trottercashion"]
feeds = Feedzirra::Feed....
I mean analyzing 2 users profiles I get a score that it is reciprocal
a.affinity(b) == b.affinity(a)
I'd like to know in particular:
which schema would u use to implement the affinity table
which db mysql, redis,..
which technology would you use to update the affinity score in background?
Thanks
...
I was trying to update Rails and I ran gem install rails from my home directory and I now have a .gem directory in my home dir.
I eventually was able to update Rails properly, and deleted the .gem folder, but I now have this extra PATH in my GEM PATHS that I wanted to get rid of:
- GEM PATHS:
- /Library/Ruby/Gems/1.8
- /Us...
I am using memcache for caching in my rails app and currently I have a dev and a production environment.
I would like to run the dev environment without caching so that I can debug more easily but I wanna enable the caching in production obviously. I am using github and capistrano for deployment.
Without doing a check at every stateme...
I want to install from a particular branch on a git repo, how do I do it?
...
so I have these relationships:
a location:
has_many :services
has_many :products, :through => :services
a product:
has_many :services
has_many :locations, :through => :services
has_many :add_ons
and a service:
belongs_to :product
belongs_to :location
has_many :service_add_ons
has_many :add_ons, :through => :service_add_on...
I have a nested form problem. I implemented the nested forms solution form the railscasts 196 & 197. It works if I have no validation errors.
So, form renders perfectly when it is loaded, including the nested fields (in the fields_for part).
But, the form has validations. When a validation fails, the controller does render :new. Then t...
I have a model in Rails representing stores
class Store < ActiveRecord::Base
A boolean field "draft" in this model determines if the record is active or if it's just a draft.
I'm using acts_as_xapian to do searches in my application and it receives a model where the search should be performed. This part is working. However, I only wan...
I have a bunch of files in the server and I want to link them to a model with paperclip, since I want to generate the thumbnails and save their info in the database, just as if I uploaded with a form.
Is it possible to use a console command passing the file paths for generating the Paperclip Model?
...