similar to: derive.js - Ruby-esque derivation/mixins for Prototype

Displaying 20 results from an estimated 1000 matches similar to: "derive.js - Ruby-esque derivation/mixins for Prototype"

2007 Nov 01
8
Specifying mixins
Hi folks, Can anyone share some accumulated wisdom about the best way to spec mixins in general, and (Jamis Buck-style) ActiveRecord "concerns" in particular? The standard situation here is that there''s a bunch of functionality, related by concept if not by implementation, that one wants to inherit in many different classes (e.g. ActiveRecord models) without having to
2004 Jun 29
1
strucchange-esque inference for glms ?
hello R-world, according to the strucchange package .pdf, "all procedures in this package are concerned with testing or assessing deviations from stability in the classical linear regression model." i'd like to test/assess deviations from stability in the Poisson model. is there a way to modify the strucchange package to suit my purposes, or should i use be using another
2008 Dec 09
7
subclassing vs mixins, which one should be used?
Hey all, I have two models in my rails project that share a lot of traits. They each have the same 4 properties, and now I need to add 2-3 methods to each one that will be the same. In the spirit of DRY I am looking for a solution to write these methods only once. Both of these models already inherit from ActiveRecord . . . and I didn''t know if it was safe to just "whip up" a
2006 May 11
1
Mixins
If I want to write a function which will be available to views, I write a helper function in one of the places set aside or that very task by Rails. If I want to write a little suite of functions to be mixed in by a number of model classes (but not all), where do I put them? Plug-ins look like AN answer, but they also seem a little heavyweight for simple, project-specific tasks.
2005 Nov 06
1
mixins not reloaded as expected?!
Hi guys, in development mode a module mixed into a helper class seems not to be reloaded inside app/helpers: class TestHelper include EvenMoreHelp #foo end module EvenMoreHelp # bar end the contents of #foo get refreshed, but not #bar... is there a way to fix that behaviour. I intend a full reload in development mode for obvious reasons. Regards Peter
2007 May 01
2
Using mixins versus delegation
I''ve been working on a plugin called Http Test where I add HTML validation and link checking to controller and integration tests through an after filter in ApplicationController. I used to mix in a bunch of methods that I needed into the ApplicationController class, but to me this had a bad smell, so I broke much of the code out into separate classes that I delegate to.
2006 Apr 11
1
Mixins?
As is often the case when I tackle a new platform/language, I get the big picture very quickly (because frameworks are frameworks are frameworks) but its the nitty-gritty of the language that bogs me down... So I have some similar methods on a few of my model classes that I wanted to push into a helper. Now I reckoned that the Ruby way was to create a module and mix it in with include. However, I
2006 Mar 05
8
Model Inheritance, Mixins and Database design
I''m trying to understand how best to use inheritance and wonder if Rail''s Single Table Inheritance model too restricting. I have a model Companies who provide 1+ Services (HABTM relationship). I assume the best way to represent this is with a series of child models representing each type of service : ServiceType < Company. I want to return lists of companys for each
2006 Feb 19
1
NOOB: ratings/voting mixin or code example?
so as to not reinvent the wheel, are there any exisiting examples or mixins for a star rating system? basically what i''m looking to do is show pictures of local models which will be voted on by users, and the model with the most votes will get her photo in a calendar. anyone able to point me in the right direction... tutorials, code, whatever would be greatly appreciated! -A --
2006 Jan 23
3
prototype.js: enumerable mixin for hash broken
Hello everyone. I am not sure if this is the right place to post, please redirect me if there is a mailinglist more specifically dealing with prototype.js. After playing around with the very inspiring prototype library I have found a rather annoying thing, that makes the usefulness of the Enumerable mixin for Hashes questionable, if I am not totally wrong (again :-). Here an example:
2007 Aug 09
7
Integrating polymorphic models into controllers views? how?
I''m having trouble trying to get this to work. How the heck do you get a polymorphic controller to work? Especially integrating it with a view? Let''s say that we have shows, and episodes, then comments. A show has many episodes, an episode has many comments. the route is /shows/1/episodes/1/ Now to add a comment to that episode, how would I do it? Let''s say that the
1998 Jan 12
0
Symbolic derivation
Wenyaun Xi <xi@keynes.econ.utah.edu> writes to S-news: > I ran into some problems when I tried to get symbolic derivation by > using a function deriv3(). The expression contains 18 > parameters, of which I want to have an information matrix eventually. I > ran it on my 200MHz Pentium PC with 64meg RAM. Each time I kick out the > job, the S-plus 3.1 for Windows stops after
2006 May 22
0
Automatic Pluar to Singluar derivation in Loops
Hallo, Enyoing the Rails framework, I often write loop like this: for j_method in @service.j_methods for parameter in j_method.parameters @output = j_method.name+ " is in "+parameter.name end end So: * @service.j_methods => j_method * j_method.parameters => parameter forall @service.j_methods forall j_method.parameters @output = j_method.name+ " is
2008 Oct 12
2
numeric derivation
Hello, I don't understand the description / help-text for the numericDeriv() function. Why is there a new environment used? And what is meant with an environment here? Is it similar or the same as a local workspace, like an environment in functional languages? And why is it needed here? numericDeriv could just calculate the difference bewtween two values and divide this difference by the
2008 Jul 11
1
prototype.js breaks treemenus from pear HTML_TreeMenu in safari
hi all i see a very strange behavior in safari when using prototype.js and the pear HTML_TreeMenu to reproduce get prototype.js (http://www.prototypejs.org/assets/ 2008/1/25/prototype-1.6.0.2.js) and treemenu.js (http://cvs.php.net/ viewvc.cgi/pear/HTML_TreeMenu/TreeMenu.js?revision=1.22). and test the following html with safari on mac or windows (http:// www.apple.com/safari/download/)
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 Sep 05
0
Reloading dependencies in Edge Rails?
I''m developing a library called Hark. The structure is: lib/ hark/ session.rb mixins.rb hark.rb hark.rb: ==== module Hark include Hark::Mixins ... end application.rb: ==== class ApplicationController < ActionController::Base include Hark end my_controller.rb: ==== def login hs = session[:hark_session] = Hark::Session.new ... end So application.rb
2006 Nov 21
2
Symbolic derivation using D in package stats - how do I properly convert the returned call into a character string?
Dear all, I am using the function 'D' in the 'stats' package to perform symbolic derivation. This works very well and it is much faster than e.g. Mathematica (at least for my purposes). First, I would like to thank the development team for this excellent function. However, I run into trouble in some cases, particularly when I am to do some operations on long expressions
2006 Dec 07
3
What does js partial(...) do?
In the example application named "sample_app", comment.jerb contains the following line: $(''comments'').update(<%=js partial(:comments) %>); What does the ''js'' method do to/with, if anything at all, ''partial(:comments)''? Merb is quite fun to use and I''m starting to get a feel for it and ruby. I''m surprised at
2009 Feb 02
2
ActiveRecord::AssociationTypeMismatch (User(#54754560) expected, got User(#54510280))
i keep getting this AssociationTypeMismatch error. i think this could be a bug related to ruby/rails when using mixins. heres a short version of my code: # user.rb require ''friend_invitation'' require ''friendship'' class User < ActiveRecord::Base include FriendInvitationUser, FriendshipUser ... end # friendship.rb ... module FriendshipUser def