I currently have a controller were I would like to keep track of logging in a separate log file, like: tracker.log. I currently get about 100,000 hits a day with this, and I would like to separate the log from all the other controllers so I can easily debug those as well as the tracker.
I couldn't find anything for the Rails::Initializer...
Hi All,
I have built a new portal on Rails which can be accessed as say: https://xyz.com
The problem with this is:
1.) It has 2 tabs – “ShipmentInfo” , “Aging Shipments Dashboard” both implemented using
<li> tags and YUI library’s tabview.
<ul class="yui-nav">
<li id="tab1" class="selected"><a href="#tab1">Shipment ...
I'm working with Ruby on Rails and would like to validate two different models :
if (model1.valid? && model2.valid?)
...
end
However, "&&" operator uses short-circuit evaluation (i.e. it evaluates "model2.valid?" only if "model1.valid?" is true), which prevents model2.valids to be executed if model1 is not valid.
Is there an equivale...
What is the best/cleanest/easiest way to maintain the edit history of records in Rails?
I'm looking for logging - who made the edits and when and the ability to rollback to earlier versions of records.
My guess is that you would use ActiveRecord callbacks on updates or deletes and instead of updating/deleting records you would create a...
What tools do you use for automated code sanity checks and adhering to the coding conventions in your Ruby apps? How do you incorporate them into your process? (I mean tools like roodi, reek, heckle, rcov, dcov, etc.)
...
We have an old legacy PHP application. Now I want to write a new application module using Ruby on Rails.
Deployment is a one problem. I guess that it should be possible to run PHP app (via mod_php) and RoR app (via mod_proxy / mongrel) on a one Apache server. I don't want to use mod_rails because it requires to run php via fcgi. So is ...
So recently in the Rails literature the non-word (please, no down grades, I know non-word is a non-word but I'm not publishing this stuff and I don't claim to be more intelligent than those who write books :) P "dasherize" has become somewhat of a de-facto term as in:
"to_xml will default to dasherizing the field names"
Now in every ot...
I am using the make_resourceful plugin in my Rails app, and attempting to use nested resources.
My controller code looks like this:
class ClientRegionsController < ApplicationController
make_resourceful do
actions :all
belongs_to :client
response_for(:create) do |format|
format.html { redirect_to client_client_regi...
I'm building an app which is going to have to handle and store a large amount of email (around 2-4 thousand a day) which will need to be seen and dealt with in various ways by a lot of people worldwide. Sounds like a ticketing system, right? With one twist -- I have a separate app which handles a lot of the processing for people who wi...
I have to be specific for this to make sense. In my application I have a model called theme which contains widget color theme information. We provide a few themes, but mainly rely on the user to create their own themes. So the question is: where do I store my themes? If I store them in the theme database, then anytime I switch databas...
Is there a built-in way of specifying asserts in Rails that will throw an exception if an invariant is broken during development and testing?
Edit: Just to be clear, I'm looking for asserts that can be placed in models or controllers as opposed to asserts that you would use for unit tests.
...
I'm writing a model that handles user input from a text area. Following the advice from http://blog.caboo.se/articles/2008/8/25/sanitize-your-users-html-input, I'm cleaning up the input in the model before saving to database, using the before_validate callback.
The relevant parts of my model look like this:
include ActionView::Helpers...
When I ask ActiveScaffold to show me a very long list (for example the list of products sold), it runs the database query to get the first page of data and it displays it. If the list has a few relations, this query might take some time to execute (over a second). Most of the time, I'm not interested in this "unfiltered" list: the firs...
I'm hopelessly trying to write a method to manipulate an array in ruby. I'm trying to generate all in-order permutations of an array where each item is in turn replaced by an outside item. An example...
Given input:
arr = ["a", "b", "c"]
Desired output:
newArr = [ ["a", "b", "c"], ["a", "b", "*"], ["a", "*", "c"], ["a", "*", "*"],...
How would I go about creating multiple database tables at runtime that utilize the same model given that rails wants to infer the table name from the model name? I want to be able to create a new object based on a model, then create a new table with a unique name that the object will reference. Does anyone have any examples or advice t...
I have some data in my development database that I would like to utilize as fixtures in my test environment. What is the best way in Rails 2.x to export a database table to a YAML fixture?
...
I am in one action on Rails, but I wish to continue processing from within another action. My code looks like this:
send(new_action) #call the new_action method
action_name = new_action #change the controller.action_name
render :action => new_action #inform the view that we're in new_action
this works, b...
I have 357 tests (534 assertions) for my app (using Shoulda). The whole test suite runs in around 80 seconds. Is this time OK? I'm just curious, since this is one of my first apps where I write tests extensively. No fancy stuff in my app.
Btw.: I tried to use in memory sqlite3 database, but the results were surprisingly worse (around 83...
The documentation at http://rubyonrails.org/documentation appears to be for the latest version of Rails, but I'm working on a Rails 1.2 app. Where can I find relevant documentation?
...
In PHP you can do:
print_r($var) or vardump($var)
which prints "human-readible" information about variable.
Is there equivalent functions / helpers for those in Ruby / Rails ?
...