similar to: Using group in with find in an ActiveRecord appropriately

Displaying 20 results from an estimated 1000 matches similar to: "Using group in with find in an ActiveRecord appropriately"

2006 Apr 19
1
AJAX - update item forms problem
I have a table showing some records from the database. These records should be always ordered by some datetime field. The list of items is changed by AJAX using RJS scripts and edits are done by showing and hiding an update form under a chosen row. Adding and updating rows works great but my problem is when the order of items is changed after making some AJAX datetime updates update forms of
2008 Mar 07
6
creating a model registry
Hi all, This is a problem I''ve approached so many times and always worked around, that now I want to solve it once and for all. Say I have something like this: --- class X < ActiveRecord::Base acts_as_wacky end module Wackinator class ControlAllWackos @@wackos = [] def self.kill_wackos @@wackos.each(&:kill) end end def acts_as_wacky
2008 Mar 04
3
remote_form_for does not work with method = :get
It seems that remote_form_for does not work with method = :get since it does not change the prototype call. Is this a bug? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe
2008 Feb 23
3
Attachment_fu: how to remove images?
I just used attachment_fu for the first time, and it works quite well. I have a user-model, and each of them has_one :image (and the images belongs_to :user). I have a question on this though: how can i remove images? Whenever i set a new image for a user (a user who already has an image), then the table with images gets updated correctly, with the user_id column of the old image set to null, and
2008 Feb 22
12
DRY - in controller or model????
Hello. I''m trying to make clean efficient code and would like to find out if there is a "BEST" way to write code. I want this to run quickly and efficiently for my app. I''ve got a form that needs a select list created for new and edit functions. Same list. Do I do this in the controller and reference @list in the forms? def new @list = %w { apple orange banana }
2009 Sep 24
5
Non-ActiveRecord based model being passed as string?
I have a model that looks like this (with various other methods) class HsdPair attr_accessor :hsd def initialize(hsd) @hsd = hsd @current_display = 0 @has_changed_flag = false end end After initializing this object in the controller @hsd_pairs = HsdPair.new(@job.hsd_pairs) using it in the view various times and in various ways, when I try to pass this object back to the
2009 Aug 07
4
ActionController::UnknownAction (No action responded to 22.
I try to switch my application from Rails 2.2.2 to Rails 2.3.3. In namespace :admin I have a resource-based controller. See controller class Admin::OSystemsController < Admin::BaseController def index ....... end def edit ......... end def update .......... end end Resource is added to routes.rb like map.namespace :admin do |admin| ............ admin.resources :o_systems,
2009 Aug 06
18
Best Practices Question
Should models call action mailers, or should those calls always originate from controllers? For example, should user.forgot_password send the email, or should the user_controller.forgot_password? Just looking for some opinions... Thanks, Tom
2009 Oct 28
2
What's the simplest way to use ActiveResource in ruby (without rails)?
I would like to use this class in a standalone project, but I have been unsuccessful thus far. Also, how does this class exactly communicate with the web server? Thank you. class Person < ActiveResource::Base self.site = "http://localhost:3000/" end
2008 Feb 29
7
Moving pagination to the Model
I''m using will_paginate in a Post class method; [code]def self.list(page) paginate :per_page => 10, :page => page, :include => :user end[/code] I can happily use the method on my posts controller index action; [code] class PostsController < ApplicationController def index @posts = Post.list(params[:page]) respond_to do |format|
2006 May 01
5
Adding classes without script\generate
Can I add classes to a rails application manually i.e without using script generate Model/Controller? The reason I am asking, I added a class by putting it in the controller class. I can access the class and its method from command-line (irb), but when I try to instantiate it in another controller, I get "uninitialized constant" error. If I try using script\generate Model
2008 Nov 20
1
My ignorance and Fuse (or glusterfs)
I have a very simple test setup of 2 servers each working as a glusterfs-server and glusterfs-client to the other in an afr capacity. The gluster-c and gluster-s both start up with no errors and are handshaking properly.. One one server, I get the expected behaviour: I touch a file in the export dir and it magically appears in the others mount point. On the other server however, the file
2007 Jan 03
3
Self-referential habtm with condition is broken
Here''s a simplistic model class. class Person < ActiveRecord::Base has_and_belongs_to_many :relatives, :class_name => ''Person'', :join_table => ''relatives'', :foreign_key => ''from_id'', :association_foreign_key => ''to_id'' has_and_belongs_to_many :brothers, :class_name =>
2008 Mar 08
9
Validation error handling on related models
I have 2 models, entity and client. Entity has_one client and client belongs_to entity. Entity has attributes name and legal_name. Entity also has an unique index on (lower(name)). The pKey for both is the conventional Rails id. Client has a fKey constraint on entity_id and is indexed in entity_id. In controllers/clients_controller.rb I have: # GET /clients/new # GET /clients/new.xml
2006 Dec 04
7
I need help to connect Postgres and Ruby on Rails Please.
Hello to everyone, I have a problem that is giving me a headache, and trying to do a project in Ruby on Rails and I need to connect with a Data Base that is en Postgres, the truth is that I didn’t think that it was so hard to connect a DB with postgres because I was working with Msyql and everything was easy. This are the thinks that I have install in my computer. 1. Debian GNU/Linux, kernel
2006 Jan 31
4
broadvoice??
Does anyone have any useful contact information for Broadvoice? I've been unable to call Argentina from my Broadvoice line for almost a month now. Their techs keep telling me they're "looking into it" but I get no real information. I've had several other tickets open for almost 8 months now. I called their PR company this morning and apparently they dropped Broadvoice
2009 Sep 29
1
Using speex for gsm-efr coding
Hello, I would like to know please whether I can use Speex for Gsm-Efr coding? Best Regards, Ilan Borenshtein RT embedded engineer ASOCS Ltd E: ilan at asocstech.com T: +972 (0)3 9012090 Ext. 214 M: +972 (0)50 5745100 F: +972 (0)3 9032112 www.asocstech.com <http://www.asocstech.com> -------------- next part -------------- An HTML attachment was scrubbed... URL:
2008 May 07
2
Begginer question: how to edit using options_from_collection
Hi, I have been stuck on this problem for 2 hours and still have no idea how to do it. Basically I have a relationship between Workout and Exercise Exercise has many Work out anyway in my code at Workout.view the edit.html that was generated through scaffold I wrote this <% form_for(@workout) do |f| %> <p> <b>Exercise</b><br /> <%= select_tag
2006 Jul 03
3
when dom0 loadavg above 1, domUs not available
I have a xen 3.0.2 running on a 733 MHz server, 1 GB RAM. It has two domU domains. dom0 has 512 MB, domUs have 256 MB each. Whenever load average on dom0 is above 1-2 (for example, compressing 200 MB file), I can''t reach any domU domain. Ping replies to domUs take very long time (it''s on LAN), and there are packet losses: 64 bytes from 192.168.11.61: icmp_seq=7 ttl=64
2007 Jun 02
1
linksys wip300 firmware
Hello, Does anyone have access to version 1.00.07 of the Linksys WIP 300 firmware? The only version on their site at the moment is 1.00.09, which the phone refuses to load. Regards, Ilan