i have budgets table with emptype_id and calendar_id actual_head, estimated_head
when i do Budgets.sum(:actual_head ,:group=>"emptype_id,calendar_id") i do not get the result grouped by the above two columns but only by the emptype_id
however when i check the log the sql query is right
"SELECT sum(budgets.actual_head) AS sum_ac...
I have two routes:
map.all_devices '/all_devices', :controller => 'all_devices', :action => 'initialize_devices'
map.show_user_date_select '/all_devices', :controller => 'all_devices', :action => 'show_user_date_select'
I want a user to click on a button, do the show_user_date_select action then be redirect back to mysite.com/all_devi...
I have a rails app with several models.
I have a function that I want to access from several models.
What's the best place to put this code and how can I make it accessible from the models that need to get at it?
My understanding is that helpers are just for views. Is this correct?
It seems wrong to create a plug-in and put it in th...
Whenever two concurrent HTTP requests go to my Rails app, the second always returns the following error:
A copy of ApplicationController has been removed from the module tree but is still active!
From there it gives an unhelpful stack trace to the effect of "we went through the standard server stuff, ran your first before_filter on...
I have a form that I'm trying to create which is broken up into sections. Each section saves a little bit of info to that table and then moves on to the next page. I'm trying to figure out the best way to validate the data for each section in the model. I was to use something like validates_presence_of, but that expects all of the data...
This is primarily a question about effective Git usage. I should first say I'm not an expert in Rails (at least in a production sense) and definitely a Git newbie, however, I have had some experience using SVN.
My problem is that I am trying to create a rails application but do not know the best way to keep development local on my comp...
I will soon be switching from sqlite3 to either postgres or mysql. What should I consider when making this decision? Is mysql more suited for Rails than postgres in some areas and/or vice versa? Or, as I somewhat suspect, does it not really matter either way?
Another factor that might play into my decision is the availability of tools t...
I often want to clear the session store in Rails, in particular, the default cookie-based session store. Some sites seem to suggest that
rake tmp:sessions:clear
accomplishes this task, but it appears that it does not. What is the proper way to clear the cookie-based session store?
...
I have a controller and a view (no ActiveRecord for this one). The controller calculates the current time in several places in the world and the view presents them.
I'd like to add a button that will make the clocks update. Adding a regular button which refreshes the whole page works fine, but I'd like to do that asynchronously using AJ...
hi all,
immediately after has_many_polymorphs install with
ruby script/plugin install git://github.com/fauna/has_many_polymorphs.git
i start getting following error whenever i try to execute smth like script/generate or script/server
=> Rails 2.3.2 application starting on http://0.0.0.0:3000
/test/vendor/plugins/has_many_polymorphs/...
I have a javascript part in my view, that I want to modify through locals I have defined in a helper.
<script type="text/javascript">
var store = new Ext.data.JsonStore({
url: '/admin/administration/users/grid_data.json',
root: 'users',
fields: [
<%- for field in fields do -%>
{name: '<%= field[:data_index] -%>'},
<%- end...
I have a custom-made blog running off RoR and I would like to implement publishing API. I would prefer to use a widely-used API - e.g. Atom, MetaWeblog, etc - so that I can post to my blog from almost any other web service - flickr, youtube, pixelpipe, etc.
...
hi, i have a rails question
how do i get controller action name inside the controller action?
f.ex. instead of
def create
logger.info("create")
end
to write something like
def create
logger.info(this_def_name)
end
what is a way to get this_def_name?
...
Hi, I have created Rails database using the following schema:
ActiveRecord::Schema.define(:version => 20090807141407) do
create_table "trunks", :force => true do |t|
t.integer "npa"
t.integer "nxxFrom"
t.integer "nxxTo"
t.string "trnk"
t.datetime "created_at"
t.datetime "updated_at"
end
end
In my CSV...
I'm looking for a CMS writen in Ruby and not based on Ruby on Rails, are there some projects?
...
I had issues when I tried to deploy my Rails site
when i start mongrel and start my app and rewrite and start with Apache
the application has ben displayed
but when i link to http://myapp.com/account/login
Not Found
The requested URL /account/login was not found on this server.
Additionally, a 404 Not Found error was encountered wh...
For some reason I'm getting an InvalidAuthenticityToken when making post requests to my application when using json or xml. My understanding is that rails should require an authenticity token only for html or js requests, and thus I shouldn't be encountering this error. The only solution I've found thus far is disabling protect_from_for...
I'm trying to render a large (ish) array of objects as a plist in Ruby on Rails. The collection currently contains up to 200 objects, each of which is essentially a record (dictionary of keys/values). The overall result format is a plist (as used by Apple) but logically it is not much different from any XML document.
The problem I've hi...
I have this line, which shows the minutes and seconds. But I have to add milliseconds to it as well for greater accuracy. How do I add that in this line, or is there an easier way to get the desired result?
@duration = [cd.ExactDuration/60000000, cd.ExactDuration/1000000 % 60].map{|t| t.to_s.rjust(2, '0') }.join(':'))
The exact durati...
I've been told that doing:
config.gem 'tzinfo'
doesn't obviate the need to require 'tzinfo'. Is this true of all gems? If yes, what exactly does adding config.gem WHATEVER do?
...