search for: mdain

Displaying 20 results from an estimated 25 matches for "mdain".

Did you mean: main
2006 Jun 06
1
Default value plugin
...ulated somehow. So you can do something like this: (repeated from an earlier post and the README) class Mixture < ActiveRecord::Base serialize :color default_value :color, [255, 0, 0] end m = Mixture.new m.color # => [255,0,0] Here''s the README: http://mdaines.com/svn/plugins/default_value/trunk/README To install: (as usual) script/plugin install http://mdaines.com/svn/plugins/default_value/ trunk Thoughts, comments? -- Michael Daines http://www.mdaines.com
2006 Apr 23
3
ANN: Polygons library + sweet demo
...releasing an extraction from an application I''m currently working on. It''s a small library for dealing with points and polygons, called Polygons. It really just implements some textbook algorithms w/ Prototype-style JavaScript classes. Check it out here: http://polygons.mdaines.com/ The demo on that page (Firefox/Safari only right now) uses the point- in-polygon function and a little trickery (nothing too involved, though) to make dragging non-rectangular objects way more natural. In the application I''m working on, I combine that with the rotation funct...
2006 Jun 02
6
Set instance variable for all actions in the Controller
Can I set an application wide instance variable that is available for all actions...and their views? eg. class ApplicationController < ActionController::Base @current_user = User.find(session[:user_id]) end and everywhere I can call @current_user.id and I can get that object? Even down in the views? I could not get this to work... Thanks in advance, Jeff -------------- next part
2006 Jun 14
2
Can pagination work with caching
I am currently caching a page that indexes blog entries. Paginate was used to break the entries up. Now when you click on next at the bottom of the page it is only reloading the first page. Im hoping, against odds, that someone here knows of a way to make paginate and cache play together. -- Posted via http://www.ruby-forum.com/.
2006 May 31
7
Getting 22 elements
Hello, I''ve done === class HomeController < ApplicationController def index @country = Country.find(:all, :include => "cities") end end === And rhtml is: === <% @country.each do |country| %> <h1><%= country.name %></h1> <% country.cities.each do |city| %> - <%= link_to city.name, :action =>
2006 May 22
6
which kind of deployment has the best performance
In the following deployment of web app on ONE pc-based server,running linux,which can support the most amount of concurrent users as well as the shortest latency? 1 apache+mongrel 2 apache+mongrel_cluster 3 lighthttpd+mongrel 4 lighthttpd+mongrel_cluster 5 lighthttpd+fastcgi Thanks charlie -- Posted via http://www.ruby-forum.com/.
2006 May 03
4
default values
Hello, I''m working with a postgresql table CREATE TABLE elements ( id serial primary key, c1 text default f1(), ... cN text default fN() ); But if I use de lines @element = Element.new @element.save the values that element take are the nextval in the id field and nules in all the other fields. How can I get the defaults? (but without rewriting the
2006 Jun 01
1
Default Value for date_select helper
Hi All: Just curious if anyone has figured out how to set a default date for the date_select helper. My application has a form with both a start date and end date select for the user. Since the period between the two is a minimum of 24 hours I wanted to have the start date default to Date.today (which it does automatically) and then have the end date default to the following date (i.e.
2006 Apr 06
0
script.aculo.us V1.6.1
...to Prototype 1.5.0_rc0 * Sortable trees [thx Sammi Williams, sammi-EeRYXuc1dym5PgFUrJwY1aU/zSkkHjvu@public.gmane.org] See the functional test (test/functional/sortable_tree_test.html) and the CHANGELOG for more information! * Add Draggable object as third parameter to snap, fixes #4074 [thx mdaines] * Add parsing/setting of any currently set opacity CSS rule to default opacity effect on draggables, fixes #3682 [thx Mike A. Owens] * Added benchmark method to unittest.js; some cleaning up of unit tests * Major speedup for sortable with handles initialization [thx Jamis Buck] * Add passing...
2005 Aug 17
2
CumulativeOffset
Hey All, I have a fairly basic question about the prototype.js library. First, I''ve been looking for documentation on this and I have yet to find it. If any of you know of any, please let me know. Since I''m new to both the scriptaculous and prototype libraries could someone explain why I would want to use the cumulativeOffset method and not to just grab the offset off
2006 May 21
3
Catching events outside document (on window chrome)
Hello, How can I catch the onmouseup event outside the ducument - means when the pointer is above window chrome (e.g. toolbar)? Event.observe(document, ''mouseup'', someListener) works only inside the document for me. Thanks in advance for your help! Thomas -- Posted with http://DevLists.com. Sign up and save your mailbox.
2006 May 31
2
calling routing during a functional test
I had a beginner''s question. I am testing the create action on my controller. I wanted to fetch the ID parameter of the newly created object, so that I can make some assertions on it. But I can''t seem to find an elegant way of doing that. Of course, might create action redirects. That means that @response.redirect_url is something like "/show/8". So I could pluck
2006 May 31
3
validate unless, LoginGenerator difficulty
I apologize if this is a very simple question; I''ve searched the forums, wiki, Google, and Agile Web Development with Rails to no avail. Is there a way to put conditional validation in the model? For instance, if I want to limit items a user can add unless the user is an admin? My current code is: validates_uniqueness_of :user_id, :scope => ''event_id'',
2006 Jun 01
3
more questions: human_name
One more question: Is there some way to set the human_name of a column? e.g.: human_name for column address1 shouldn''t be Address1 but "Address, line 1". If not, should I make a hash with my custom names? Best regards, -- ---------------------------------------------------------------------- Yannick Majoros http://www.inma.ucl.ac.be/~majoros Informaticien UCL/INMA-MEMA
2006 May 30
2
acts_as_queue
wondering if anyone tried this patch. (i havent, seeing as its 1228 lines long, 10 months old, and cant take serious a patch many orders larger than competing web frameworks) in many cases i want to keep about 10 things around, eg recent searches, new items (spanning multiple classes), referers, page views, without logging them for perpetuity. so i guess this isnt a normal queue, more like a
2006 May 18
2
Help with Routes
I love the routes feature for RoR...until now. I''m trying to write tests to make sure my urls are correctly mapping to the routes I expect them to map to. This is driving me nuts because I simply can''t get any of my tests to pass. I have thus concluded that routes must work differently than I thought. I will try to explain my understanding of how routes work. Via this
2006 May 21
9
[OT] Interoperability - Was "We''re adding Rails development features to the S"
On 5/21/06, ReggW <me@yourhome.com> wrote: > > Rafael Zanetti wrote: > > I never said I knew one IDE based on Visual Studio. > > > > What I really meant was: Why you, software companies, only think in > > windows > > as your development plataform? Not only for IDE but for everything. > > > Because its a platform with consistency and its what pays
2006 Nov 14
11
RESTful mixin, mixin repo?
Hi, I just put together a little mixin to provide pseudo-RESTful services in camping apps. Basically, it looks for a hidden _verb field in form posts, and sets the @method to the supplied value (e.g. put or delete - which browsers don''t support). This lets you define put and delete methods in your controllers. Groovy. Code: http://pastie.caboo.se/22613 Is there any permanent repo of
2006 Apr 19
4
Another DRY question
I have some code working that lists only items from a particular user. The code in my list action finds the user and then conditionally lists only his/her items: def list user = User.find(session[:user]) user_id = user.id @product_pages, @products = paginate :products, :per_page => 10, :conditions =>[''user_id = ?'', user.id]
2007 Jan 26
10
Camping and DBI
Hi, I''ve been playing around with using DBI instead of ActiveRecord ''cause I just love to beat myself up! ;) Is this an okay way to do this, or is there any other more creative ways? require ''dbi'' module MyApp:Models class DB def self.dbh DBI.connect(''DBI:Mysql:dbname'', ''username'',