Hey all,
I have a mondoDB with data in it at the moment which I am querying with Ruby on Rails. I am looking to index the database to speed things up a bit.
I read the mongoDB documentation and followed the instructions on how to add a index, like so:
db.collection.ensureIndex({"key": 1})
This returns true and returns this in the co...
Now with Formtastic I have plain select:
= f.input :category, :as => :select, :include_blank => false, :collection => subcategories
Here I show only children categories. I use acts_as_tree plugin for parent-child relationship. I would like to show parent categories as well.
Formtastic generated select should look like this one:
<sel...
I can see I should ignore tmp/ and log/ but are there any other files which shouldn't be in the repository.
...
I'm just a beginner using Ruby on Rails for building website.. Here they hv not clearly mentioned the difference between link_to and link_to_unless_current
plz help as soon as possible
...
I'm working with google annotated time line graphs: http://code.google.com/apis/visualization/documentation/gallery/annotatedtimeline.html
My question is: I would like to limit the X-axis to show just a range of hours between 5:00 and 21:00. Today I'm showing already per hour but I would like to limit the range and not show 24 hours. Is...
If you have a Rail app with many complex associated models, what techniques do you employ to reduce database queries?
In fact, I'll extend that question a little further and ask, what do you consider "too many" queries for any page?
I have a page that I expect will end up hitting the database about 20 times each page load. That concern...
Given the relations
{
proposals(id, ...),
reviewers(id, ...),
comments(id, user_id, proposal_id, ...),
votes(id, user_id, proposal_id, ...)
}
how can I create an association from Vote to Comment? Each reviewer can vote once on a proposal "create unique index on votes(user_id, proposal_id)" and can comment many times. A...
I'm new to testing, and I'm having some difficulties trying to run a functional test.
I've a messages_controller, and a user_controller here.
in the routes, I've defined that the users resources has_many message resources.
Now I'm trying to run a simple test in the messages controller:
def test_index
get :index, { :user_id => 1 }
...
How to test OpenID in rails with cucumber. Does anybody have real example? For example by using Fakeweb. Thank's
...
So I've had Delayed::Job running swimmingly in production for a while.
Whenever i'd make a change to a job I would (all in the production env mind you)
restart delayed job using the [script](http://wiki.github.com/tobi/delayed_job/running-delayedworker-as-a-daemon) i used clear the jobs using `rake jobs:clear`
Also, i have monit runn...
Hi,
I'm using fragment caching a lot and it is essential to me for good performance. However, due to the complexity of the caching I'm using, I need to offer my testers, a way to disable/enable caching as a session variable. (On a user basis only)
I was thinking about implementing a cache_disabled? method, and I now check for it's valu...
can you recommend me a Rails Plugin/Gem that emails error reports?
...
I have a submenu placed in my layout wich differs from controller to controller, but not between each controllers method views. What I am currently doing is the following:
<% content_for( :submenu ) do %>
<%= render :partial => 'submenus/correct_submenu' %>
<% end %>
In every view for a method
My applications layout then has this...
Hello,
I was using the spawn plugin (http://rubyforge.org/projects/spawn/) which worked excellent. However, I then moved to Mongo (using mongo_mapper) and Spawn no longer worked.
Modifying the plugin is beyond the scope of my abilities. Is there a simple way to do spawning in Rails that would work with Mongo? It's not an often-run proc...
Say I have the following association with an attached condition:
belongs_to :admin_user,
:class_name => 'User',
:foreign_key => :admin_user_id,
:conditions=> 'users.admin=TRUE' # or any variation with hash or array, {:admin => true}, etc.
The API doc states that the :conditions option on belongs_to will:
Specify the...
To gain more understanding of how HTTP requests are handled in case of web apps, how does a web server like Apache, dispatch a request to one of its Virtual Hosts? What are the initial programs executed irrespective of the framework (Rails/PHP/Java)? I would appreciate if someone can list the steps taking example of Rails (as I know Rail...
I am getting 406 Not Acceptable error when submitting my form with jQuery. I have tried the common fix found on the web:
jQuery.ajaxSetup({
'beforeSend': function(xhr) {
xhr.setRequestHeader("Accept", "text/javascript");
}
})
This hasn't fixed the problem. request.format outputs text/html. I have been racking my brain all d...
I have two databases in use in a Ruby on Rails application; one is the database for the application while the second is an independent database over which Rails is not given control.
Problem is when loading fixtures into the dev, it tries to run DELETE statements on the tables in the independent database from the connection to the dev d...
Hello,
I have a an method that retrieves Groups that are present in certain areas. Groups are given a country_id, region_id and city_id
The UI gives three select boxes to choose a country, a region from that country and then a city from that region. To find all groups in a particular city, I have this code:
@groups = Group.find(:all, ...
Hi i'm using a has_and_belongs_to_many in a model.
I want set the valitor of presence for kinds.
and set the max number of kinds per core to 3
class Core < ActiveRecord::Base
has_and_belongs_to_many :kinds, :foreign_key => 'core_id', :association_foreign_key => 'kind_id'
end
how can i do?
thanks
...