Displaying 20 results from an estimated 80 matches similar to: "mixin behavior"
2006 Dec 11
1
Using link_to_remote to add a record
I am trying to use link_to_remote to simply add a record to a database
table called "ratings". I''ve seen some examples of this being done but
can''t seem to get it to work. Any ideas about what I''m doing wrong?
Here is what I have in my view:
<%= link_to_remote( "1", {:url => { :controller => "ratings", :action =>
2007 Jun 04
1
acts_as_rateable in Beast
I''m trying to implement acts_as_rateable to my Beast installation to
give users the option to rate posts (like reddit). I chose
acts_as_rateable as it supposedly easily allows reddit-type voting but
I''m having some problems setting it up and the documentation seems
outdated.
(http://www.juixe.com/techknow/index.php/2006/07/05/acts-as-rateable-plugin/)
So far, I''ve
2008 Aug 27
5
VALIDATION QUESTION
I''m trying to validate a record before save. I''m using one controller
in this case furnii where I have all my calls. The problem is that, the
form containing the field I''m trying to validate resides in the furnii
views. I tried to add validates_presence_of :content (the field name) in
both the furnii model and the ratecomment model but it does not work. I
know there
2008 Jul 01
2
rateable plugin problem
I am having some problem figuring out how to use the rateable plugin. i
followed as close as the directions located at
http://www.naffis.com/blog/articles/2006/08/31/rails-ajax-star-rating-system
but there seem to be some problem.
I am getting the following error
You have a nil object when you didn''t expect it!
The error occured while evaluating nil.rating
Extracted source (around line
2006 Sep 23
8
acts_as_rateable plugin help!
Hello,
I am having some trouble figuring out how to use the rateable plugin. i
followed as close as the directions located at
http://www.naffis.com/blog/articles/2006/08/31/rails-ajax-star-rating-system
but i fail at working it.
i am getting this error
You have a nil object when you didn''t expect it!
The error occured while evaluating nil.rating
Extracted source (around line #1):
1:
2006 May 10
1
model mixin module madness
If I have several models which exhibit the same functionality, it seems
makes sense to create a mixin, ''include'' it in each model and save
myself some work and repeated code.
Where can I define a module which will be available to all models? I
can''t seem to find a documented place for them.
Alternatively, is there a Rails-standard way of achieving the effect?
Ben
2006 May 19
0
Works in model but not in mixin
Disclaimer: RoR newbie. Using the acts_as_taggable plugin.
As an exercise I wanted to switch from the destructive TAG_WITH method
to adding tags while preserving the existing ones. On the surface this
seemed easy enough and eventually I got it working. However, the
following method:
def add_tags(list)
Tag.transaction do
Tag.parse(list).each do |name|
if
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 Feb 22
5
Auditing mixin for model classes. Small problem
I want to include common auditing functionality in my models. This
involves storing the changes made to a model in a seperate table :
I have created the functions in an Audit module :
module Audit
before_update :before_changes
after_update :after_changes
def before_changes
old=self.class.find(id).attributes
@changes=[]
attributes.each do |key, val|
if val != old[key]
2006 Apr 18
4
Mixin variables
I''ve created an access control module that I''m including in several
different controllers. Everything works fine, but I want to allow each
controller to override the default login page with something like this:
set_login_pages :secure => ''my_login''
In my module, I''ve set up the set_login_pages method like this:
def self.included(base)
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 Jan 15
6
PROPOSAL: Validations as Mixin
It seems to me that Validations are quite useful for many objects, even
ones having nothing to do with ActiveRecord.
Common examples are Contact Us forms, multi-step forms, web service
paramater validations, etc.
I took a look at the source for Validations, and it seems that it is
very independent from ActiveRecord. I caught only three depenedencies:
1. validates_numericy --> depends on
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:
2006 Mar 26
5
How to write manage created_on and created_by via mixin?
Hi!
Definite newbie here - I''m working through this like-hate relationship with
Ruby and Rails right now... sometimes things work really well (like blobs
seem to rock) but other times, I dunno! :-)
Anyway, I''d like put in create and update user timestamps on all my primary
domain tables and allow them to be updated automatically by ActiveRecord.
Coming from Hibernate, I just
2006 May 17
3
Help mixin in class methods
Starting to feel more confident and code is DRYing up nicely, but I''ve
hit a brick wall here and hoping someone can help me.
I''ve got a module, TrustRanking, which extends a number of model''s
instance methods, and I want to extend their class methods too, but I
can seem to work out how to do it.
Simply including the module from the class works a treat for the
2006 Jan 04
11
Query Mixin by Duane Johnson
Hello
At the start of October, Duane Johnson announced the Query mixin plugin on
this list. The code was attached to the announcement email. Unfortunately,
I''ve not been able to locate the attached code. Goggle has not helped me
this time. Could somebody forward it to me?
Thanks in advance
Harvey
This e-mail has been scanned for all viruses by MessageLabs.
2012 Oct 02
0
Error messages when attempting to calculate polychoric correlation matrices using the psych package
Dear Professor Fox,
Apologies for my oversight relating to the polychor command and thank you for your advice. I turned to the polychor command when trying to find an equivalent for the polychoric command found in the psych package (I am following a procedure outlined in Gadermann, Guhn & Zumbo, 2012 that uses this command rather than the polycor package) . The polychoric command is returning
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.