similar to: polymorphic url and polymorphic partial helpers

Displaying 20 results from an estimated 10000 matches similar to: "polymorphic url and polymorphic partial helpers"

2006 Jul 31
3
Polymorphic associations and single table inheritance
Running into an interesting problem that at first glance appears to be a bug in the AR association code. However, it''s explicitly coded this way so I''m not so sure. I have some code like this: class Address < ActiveRecord::Base belongs_to :addressable, :polymorphic => true end class Person < ActiveRecord::Base has_many :addresses, :as => :addressable,
2006 Aug 07
1
Eager loading wierdness
Consider this problem. I have an Item that has_many Features I want to find all Items with a Feature name of ''foo''. Normally you would do this.. @items = Item.find(:all, :conditions=>["features.name = ?", ''foo''], :include=>:features) This all works fine and dandy except for this problem. If you do this... <% for item in @items %>
2006 Aug 02
5
Fun with ez_where
I''ve been trying to use the ez_where plugin to create a dynamic finder. The structure looks somehing like this.. === controller === def list attribute_filter = params[:filter] @filter = Caboose::EZ::Condition.new :table do attribute <=> attribute_filter if attribute_filter end # ... do the find with the @filter # end === view === .... <%= link_to
2008 Jan 21
8
Polymorphic URL helpers documentation and fixes
Yesterday I answered a question regarding polymorphic URL helpers on Core ML and noticed that the module has no documentation. I''ve documented it and rewritten unit tests using Mocha. I also optimized some of the code slightly (nothing major, though). The patch also includes two fixes by Geoff Buesing, who has done awesome work in this area in the past.
2006 Aug 07
0
multi-state check boxes
Has anyone tried to create a tri-state or multi-state checkbox control for rails? What I''m looking for is a control that will cycle through a series of states when clicked. Like ''No'' -> ''Maybe'' -> ''Yes'' -> ''No'' .... _Kevin www.sciwerks.com -- Posted with http://DevLists.com. Sign up and save your
2006 Jun 12
0
Rails Testing Strategies
As part of an application I am developing, I have been delving into the dark art of Rails testing. Since the existing literature on the topic is a bit sparse, I have written up a couple of brief articles on testing strategies for rails. The first one is on the usefulness of ''Positive and Negative Controls'', and the other is a simple way to make sure you are working with
2006 May 24
3
using a helper from the console
I''ve got a couple of helper functions in my application_helper file that I would like to run from the console (for debugging). What is the correct way to invoke a helper from the console? _Kevin -- Posted with http://DevLists.com. Sign up and save your mailbox.
2006 Mar 19
2
Multiple polymorphic belongs_to declarations
I have the following models: class Card < ActiveRecord::Base belongs_to :deck belongs_to :front, :polymorphic => true belongs_to :back, :polymorphic => true end class TextContent < ActiveRecord::Base has_one :card, :as => :front has_one :card, :as => :back end The conflicting has_one declarations don''t work. What I need is
2006 Jul 20
11
Any good alternative to single-table-inheritance?
I''m looking to implement model inheritance in a new application. Is there any good alternative to single-table-inheritance? -- -Alder
2006 Jul 15
12
Safe way to destroy records
Hello, how can I check if a destroy was successful? Is the object only frozen if deleted or do I have to do an additional find to see if there is a record left? What happens if an after_destroy callback returns false? Is there always a rollback? Markus
2006 Mar 09
4
Testing Migrations
Is there some standard way to test migrations? It seems to me that an additional safeguard for migrations would be to test and see if applying the migrations to the test database allows one to reconstruct the structure of the development database. If you can''t, then there is an error in your migrations, most likely because someone hand-modified the database without generating a
2006 Feb 08
3
Using shared RJS templates
I''ve got an action in my application controller that needs to call a shared RJS template. Typically it''s actually being called by subclasses of the application controller. I''ve tried this.. def action ...code.. render :partial => "shared/template" end with ''_template.rjs'' existing in the shared folder. The problem that crops
2006 Jul 07
3
dynamically updating a listbox from another listbox
Hi, I would like to be able to dynamically (without reloading the page) change the values from one listbox when a user select items from another listbox. I have a model ''Sector'' which has_many ''levels'' (and of cours, ''Level'' beyong_to ''sector''). I want to show the user two listboxes with the sectors and levels. But
2009 Sep 21
0
Polymorphic form
I have two partials to deal with contact information. The Contact information uses single-table polymorphism. I want to be able to use save on Contact and set ''type'' manually, based on the type of form the user is filling in. This is saved as the value on a hidden field. class Contact belongs_to :person acts_as_list :scope => :person validates_presence_of :type
2006 Feb 08
3
RJS templates before, during and after
RJS templates are nifty. They let you put all sorts of fun effects all over your bland html pages without too much work. The link_to_remote function also lets you run scripts before, during, and after an AJAX call is run by using callbacks. There does not seem to be an equivalent method for running an RJS template before or during an action. Rendering it at the end is no problem. One
2006 Jun 02
2
Group checkbox toggling
This isn''t really a scriptaculous question, but it might be interesting anyway. I''m generating a rails app and in one form I have a grid of check-boxes (rows = A..H and col=1..12). I would like to put a checkbox in the column/row headers to toggle the boxes in a particular row or column. Each box has a name like ''position_A1'' or
2006 Feb 17
2
Helpers?
Would I use a helper for this situation? I have a layout that is used over two controllers (admin and login). Each controller has their own navigation. Can I do something like this? <%= getNavigation("admin") %> or <%= getNavigation("login") %> And return the navigation list depending on the string sent? Seth Buntin -------------- next part
2006 Jul 15
13
Active Record: Can it auto-create database tables for you?
Hi, Just get started with Rails and I''m trying to read ahead and find out whether Active Record supports auto-creation of database tables for you? Is this supported, or is the concept that you write your own database DDL to do this? Thanks -- Posted via http://www.ruby-forum.com/.
2006 May 04
12
RJSCallback 0.1
Announcing RJSCallback 0.1 The RJS Callback plugin is being developed to provide Ruby On Rails with the ability to easily call RJS templates for the various callbacks associated with AJAX function calls (e.g., :before, :loading, :complete). Currently this plugin automatically detects, loads, and renders RJS templates with specific names and inserts them in the appropriate spot in
2006 Jul 26
4
Dropdown with concatenated columns.
What is the best way to create a drop down where the viewable text in a concatenation of 2 or more columns? For instance, I hane a lookup table with these columns. Model FOO columns: id , name, phone In my drop select tag, I''d like the user to see: "name1 phone1" "name2 phone2" etc.. I know I can do this using find_by_sql . .. But, isn''t there a more