similar to: Overriding ActiveRecord associations for special cases

Displaying 20 results from an estimated 2000 matches similar to: "Overriding ActiveRecord associations for special cases"

2009 Aug 10
1
Call AR belongs_to association accessor ID method on object assignment
Hi, Haven''t been able to find this raised before but I''m sure it must have been. When assigning an object to a belongs_to association I would like it to call the *association*_id= method instead of directly updating the attributes array. This is because I want to modify the behaviour when assigning a particular object without writing separate methods for whether it''s
2009 Mar 15
5
Setting DEFAULT_FIELD_OPTIONS in Rails 2.3
Hi, I''m having some trouble overriding/defining the default_field_options constant without raising a warning. I''ve tried adding the code to do it in an initializer but that produces a warning (because the constant is already frozen), after some googling I found a recommendation to put it in the environment.rb file but that then that throws uninitialized constant ActionView
2008 Aug 21
4
radio_button_tag - examining the selected value
Hi All I have four radio buttons created like this <%= radio_button_tag :answers, 1, false %> a <br/> <%= radio_button_tag :answers, 2, false %> b <br/> <%= radio_button_tag :answers, 3, false %> c <br/> <%= radio_button_tag :answers, 4, false %> d <br/> And then I have a link_to tag to invoke a controller function
2008 Jun 30
3
scaffold usage
is there anyway that scaffold would read the database and I don''t have to specify any of the columns? it is really frustraiting specially when you''ve got a lotta cols and tables! I''d like to use rails for an enterprise app but not a toy app like all those apps in tutorials -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~
2008 Jul 07
6
MiniMagick, and processing thumbnails...
I have a requirement that can''t be that outrageous.... I want to be able to upload an image, and have multiple thumbnails be created for each. Then, I want to post process each image (the main image plus the thumbnails) to add borders. The trick is that the borders need to be different for each image. I thought I could use the after_resize handler, but when I try to add a border to
2008 Jul 01
8
Scaffolding: Create, Edit, Destroy in admin area
Hi Community, I''m currently trying to create a blog software in rails, but I''ve got a problem: I generated scaffolding for my articles and only want administrators to write, edit or delete articles. So I wanted to move this parts to another, secured controller. The one controller to display articles is called articles :), the other is also called articles, but is located in a
2013 Mar 18
9
Rails 4.0 Example app
Hi All, I have 30 years as a self employed software engineer and have been experimenting with rails for several years but !! I would have made considerably more progress and been able to give back to the community if only there was a demo application that was released with each new rails release. I am sure that it would take no more than 15 minutes of someone within the core team to produce
2011 Mar 15
10
Set bounce address with ActionMailer::ARMailer
Hi all. I send out mails using ActionMailer::ARMailer, via an exim mailserver. Is there some header/field that i can set so that the reply field is (eg) webmaster-jMbK1v/RW1uaMJb+Lgu22Q@public.gmane.org but bounced (ie undeliverable) mails get sent back to (eg) noreply-jMbK1v/RW1uaMJb+Lgu22Q@public.gmane.org? thanks, max -- Posted via http://www.ruby-forum.com/. -- You received this message
2007 Dec 25
2
about playlist handler in ices-0.4
Hi... i would like know how to one playlist handler whith perl? where a search one "HOW TO" thanks.. -- ALPHANET INFORM?TICA LTDA www.alphanetbh.com.br Belo Horizonte MG Leandro Campos (31)30726251 (31)87883925 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/icecast/attachments/20071226/c577c111/attachment.htm
2008 Aug 20
2
Re: Stubbing out ThinkingSphinx for Rspec
Thanks Wolas! Sorry if this seems like a newbie question, what am I supposed replace the stubbed_method_name with? Also, I came across the only thread on the Interwebs which seems to cover this topic - it''s over a year old, but I think they have a solution which could work around the issues you pointed out. However, I couldn''t work out how to get their subbing approach to
2006 Oct 14
2
Documentation for html_options = {}
Hi, trying to locate documentation for html_options = {} as allowed in RJS calls such as link_to_remote. Can anyone point me in the right direction please? --~--~---------~--~----~------------~-------~--~----~ 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
2008 Oct 30
2
Desktop Choice Centos 4/Centos 5 or Fedora 9
I have a choice of CentOS 4/5 and Fedora 9 on a laptop. I have not use CentOS 5 on a desktop but have used CentOS 4 and Fedora 9. I found the Fedora Gnome not as appealing as the CentOS 4 clearlooks. Any opinions from someone who has used CentOS 4/5 and Fedora? I'm not a KDE fan so KDE users need not reply. Regards, Vandaman.
2008 Jul 01
14
rake aborted! Could not find table ...
I am getting a rake aborted error and I suspect that I am missing a package on my system since the app works for a friend on this computer. Here is the terminal output of the error: anita@anitas-computer:~/sandbox/shovell$ rake db:migrate (in /home/anita/sandbox/shovell) rake aborted! Could not find table ''stories'' (See full trace by running task with --trace)
2013 Dec 06
1
replace-brick failing - transport.address-family not specified
Hello, I have what I think is a fairly basic Gluster setup, however when I try to carry out a replace-brick operation it consistently fails... Here are the command line options: root at osh1:~# gluster volume info media Volume Name: media Type: Replicate Volume ID: 4c290928-ba1c-4a45-ac05-85365b4ea63a Status: Started Number of Bricks: 1 x 2 = 2 Transport-type: tcp Bricks: Brick1:
2008 Jul 01
6
validates_associated & foreign keys
Hi, I''m struggling to get the validates_associated to work as I think it should be. I''m using: JRuby 1.1 rails-2.0.2 activerecord-2.0.2 activerecord-jdbc-adapter-0.8.2 My tables in MySQL: CREATE TABLE area_codes ( id INT UNSIGNED auto_increment primary key ... ); CREATE TABLE markets ( id INT UNSIGNED auto_increment primary key, ... ); CREATE TABLE
2006 Aug 25
7
acts_as_ferret with conditions
Hello guys, Having a slight problem with acts_as_ferret, specifically using a condition. I have the following code @results = SupplierProduct.find_by_contents(params [:search], :conditions => [''area_id = ?'', @area]) and it seems the condition isn''t being applied. Does anyone have any pointers? Cheers, Alastair ------ Alastair Moore Standards compliant web
2009 Sep 23
5
Overriding AR read/write_attribute - Overridden write_attribute Is Never Called
Could someone explain this? #config/initializers/ar_attributes.rb module ActiveRecord module AttributeMethods alias_method :ar_read_attribute, :read_attribute def read_attribute(attr_name) p "read_override" ar_read_attribute(attr_name) end alias_method :ar_write_attribute, :write_attribute def write_attribute(attr_name, value)
2006 Aug 19
1
Re: validates_associated
On 8/19/06, Alastair Moore <alastair-mb+lb5rSoAr10XsdtD+oqA@public.gmane.org> wrote: > > Hello all, > > Having a bit of a problem with validates_associated. I assume I''m missing > something out but basically got these two models - > > class Seller < User > > has_one :profile, :foreign_key => ''user_id'', :dependent => :destroy
2009 Mar 17
4
Preventing a submitted hash from ActiveRecord DB store
Hi all, I have a multi model form (Project with many tasks) and I want to prevent a task from being saved to the DB if it is empty ie. if there is no i/p for that task from the user. I tried the following class Task < ActiveRecord::Base before_save :check_if_empty ... def check_if_empty self.destroy if description.blank? end but i get this TypeError in ProjectsController#create
2006 Jun 26
1
samba 3.0.20 + squid 2.5 : automatic logon with internet explorer
hello, samba is setup PDC with ldap client : windows xp pro sp2 server : samba 3.0.20 + openldap 2.2 + squid 2.5stable14 + squidGuard is it possible to create an automatic logon with internet explorer ? perhaps with ntlm_auth, but i can't find the good sentence. thanks.