similar to: Extending ActiveRecord::Base

Displaying 20 results from an estimated 800 matches similar to: "Extending ActiveRecord::Base"

2005 Sep 06
4
url_for: :overwrite_params went missing
Somewhere between 0.13.1 and the current SVN version the :overwrite_params option to url_for (and related methods) went missing. I can''t tell whether this was deliberate or by mistake, and I have no idea how to get the same functionality in some other way either. Michael -- Michael Schuerig Life is what happens
2005 Aug 16
1
Defining model classes for enumerations
I have several tables for enumerations. They all have the same content: id, name, position. I''d like to avoid the tedious work of defining a class for each one explicitly. Not least, in order to avoid clutter in the model directory. Here''s what I''ve come up with: class EnumRecord < ActiveRecord::Base def self.define_enums(*enums) enums.each do |spec|
2005 Aug 04
10
Rails Spin-offs WIKI.
http://rails-spinoffs.bombdiggity.net/index.php?title=Main_Page guys here is the wiki. Once you register let me know and I''ll give you full access to the site. Jon Jon Whitcraft Online Services (317) 492-8623 -------------- next part -------------- An HTML attachment was scrubbed... URL:
2005 Sep 13
3
Alternatives to Rico LiveGrid?
I''m no friend of paging, but I have to somehow deal with lists of potentially large numbers of objects. The Rico LiveGrid[*] at first blush seems attractive, but has some major drawbacks. It doesn''t work with Safari/Konqueror, not yet anyway. It can only handle fixed-size tables and requires that widths, including column widths, are hand-crafted. I''m looking for a
2005 Aug 28
8
Save and delete buttons: POST vs. proximity dilemma
I''m in a dilemma: In order to keep GET requests from deleting objects, I''d like to use the button_to helper to get "something" that generates a POST request. Unfortunately, that something is a form and forms can''t be nested. I''d also like to place buttons related to the same form close to each other. At the top are some navigational buttons
2005 Dec 30
4
High performance queries - RoR, PHP or something else?
Hi everyone, I''m building an app in RoR that apart from the normal web interface has a web service. This web service takes a parameter and uses that in a single database query, and returns the result in a simple XML format. This web service needs to be quite fast as it will be used on all pages of a quite big site with thousands of visitors every hour. I don''t think caching is
2005 Aug 22
8
Observing changes to a text field
I''ve noticed that using several TimedObservers (prototype.js) on a page to watch for changes to text fields (haven''t tried forms) can have a non-negligible effect on the CPU cycles used by the browser process. Nothing dramatic, to be sure, but unnecessary. Autocompleter.Base (controls.js) follows a smarter strategy to watch for changes. Currently this functionality is tied
2005 Aug 19
13
Enumerations (again): Comments please
Some of my earlier questions may have hinted ever so slightly in the direction that I''m trying to implement "enumerations". By an enumeration here I mean a class that has a fixed number of immutable instances, which in turn have essentially only a name and a position. Requirements I''ve tried to meet are - Enumeration instances should only be loaded once from the
2005 Sep 06
1
US Date Handling in Rails
My application is built on Rails and MySQL. It will only be accepting US formatted dates as input, however both Rails and MySQL are oriented around ISO the format. I know I can convert a good portion of the entries using ParseDate::parsedate but it does not appear this is how the conversion is taking place when data is being transferred from the params hash into model members. Say I have a field
2005 Aug 18
8
Extending a js class
It''s been a few days since I posted my last two emails (of which, no one replied to) so I''ve gone ahead and coded a working slider class as well as a ''resizeable'' class that allows a user to drag and resize the element. I also linked these two together as I want to have slider behavior that can resize the resizeable element. The end result is both the
2005 Sep 13
12
PDF views?
I know there''s wiki page on generating PDF[*], but that''s not really what I want. I don''t need to create arbitrary PDF. What I''d like to do is create PDF templates and fill in the blanks. Roughly, I''m looking for functionality akin to the mail merge feature of word processors, including conditional and repeated elements, say, table rows. Michael
2005 Jul 06
16
Autocompletion not working in Konqueror
I''ve just had a look again at the autocompletion demo that Thomas put up at http://script.aculo.us/demos/ajax/autocompleter Unfortunately, in Konqueror (3.4.1) it doesn''t work at all. Not even an error is triggered. It does work nicely in Firefox. How about Safari? I don''t have the time right now to track this down systematically (maybe latter), but just from
2009 May 12
4
has_many :through and scopes: how to mutate the set of associated objects?
I have a model layer containing Movie, Person, Role, and RoleType, making it possible to express facts such as "Clint Easterbunny is director of the movie Gran Milano". The relevant model and associations look like this class Movie < ActiveRecord::Base has_many :roles, :include => :role_type, :dependent => :destroy has_many :participants, :through => :roles, :source
2009 May 19
4
proper way to ensure atomic model changes
Hi! Say we have a rails active-record-based model called "instance" which can have different states - STOPPED, RUNNING, STARTING_UP, SHUTTING_DOWN, etc... There is a method #start which changes the instance state to STARTING_UP only if it is STOPPED. def start if self.state == STOPPED self.state = STARTING_UP self.save ... end end As you understand if we have multiple
2005 Jul 26
6
implement audit trail table
has anyone has any idea how to implement audit trail table for all update / deletion done on records? I''m thinking to have corresponding audit trail table to each table, so everthing before an update or deletion is done, a new record will be insert into the corresponding audit trail table. Is there a way to overwrite the save, destroy, method at the application level? so that I do not
2010 Sep 15
5
OT: Installing static binary of wkhtmltopdf
This is OT but have not been able to get a response elsewhere (stack overflow and the project site itself) so thought someone here might know or have some ideas. First, I am using wkhtmltopdf stand alone without any of the rails gems as I found that for some reason using WickedPdf or PdfKit my pdf''s did not generate with active links from the links from those in the html. When I run
2005 Aug 07
11
HABTM Movable Select Box
Hi, I found it a while ago, an add-on to Rails for supporting movable select boxes, but I searched through the wiki and the mailing list and couldnt find what I was looking for. I was hoping someone might know of or remember something about the project. Thanks, Dylan.
2005 May 17
3
validates_associated / error_messages_for
When a validates_asssociated fails... I get something like Address is invalid is there a way, preferably on a per-association basis to have the error messaage include the actual error like Zipcode is too long (max is 10 characters) _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
2006 Jul 27
9
Introspecting validates_presence_of
Hello people, I''d like to detect whether an attribute of a model has vaildates_presence_of applied to it so I can automatically apply a mandatory (*) to the field...it doesn''t look easy...any ideas? Cheers, -- Dan Webb http://www.danwebb.net
2005 Jun 29
14
Unobtrusive scripting?
Currently, pages generated by Rails tend to be sprinkled with JavaScript. This happens, because the various helper methods work only locally and simply append to the output. In order to hide the JavaScript away, rendering would probably have to be changed. A way I can think of is that a page-specific script is included in the head of the document and JavaScript code is not written to the