search for: instancetag

Displaying 20 results from an estimated 32 matches for "instancetag".

2006 Sep 04
1
Overriding ActionView::Helpers::InstanceTag::DEFAULT_TEXT_AREA_OPTIONS
What is the best way to override some of the FormHelper default options? Right now I''m adding this to the beginning of my environment.rb: ActionView::Helpers::InstanceTag::DEFAULT_TEXT_AREA_OPTIONS = { "cols" => 80, "rows" => 5 } Is that the way it''s supposed to be done? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk"...
2013 Feb 28
1
Make `ActionView::Helpers::InstanceTag#tag_id`, `ActionView::Helpers::InstanceTag#tag_id_with_index(index)` public?
As I asked in StackOverflow<http://stackoverflow.com/questions/15127658/hoe-to-get-tag-id-from-a-record-in-form-for/15129741> I think it would be helpful since we can dynamically create javascript code to control each input tag in form helper, what do you think? Or there has already been a solution? -- You received this message because you are subscribed to the Google Groups "Ruby
2005 Nov 04
0
RE: Why class InstanceTag is defined at 4 different places inRails
In Ruby you can add and modify existing classes at will simply by reopening it. The 4 files you mention add functionalities to the InstanceTag class. This is not a redefinition. The best part is that you can do the same ! An easy way to overwrite an existing method or to add new ones is to create a file under you rails application lib directory and put in it the replacement you want to make: module ActionView module Helpers class I...
2006 Jun 02
6
overriding constants
Hi there, I''m trying to override the defaults for form_helper. I can see in action_view/helpers/form_helper.rb: class InstanceTag #:nodoc: include Helpers::TagHelper attr_reader :method_name, :object_name DEFAULT_FIELD_OPTIONS = { "size" => 30 }.freeze unless const_defined?(:DEFAULT_FIELD_OPTIONS) DEFAULT_RADIO_OPTIONS = { }.freeze unless const_defined?(:DEFAULT_RADIO_OPTIONS)...
2006 Jan 25
0
InstanceTag
Hi, I''ve been prying my way around form helpers and I need to do something very similar to date_select. I was thinking I might be able tailor it to suit my purposes and then came upon InstanceTag.new with a call to_date_select_tag at the end. I can''t find any mention of these anywhere else - can anyone give me any pointers as to what these two things do? thanks dorian -- I do things for love or money -- +44 (0)7941 219 501 -- aim:oulalipo | yahoo:tachekent
2007 Mar 09
0
InstanceTag#value changed in 1.2
In Rails 1.2, the interface to InstanceTag#value and #value_before_type_cast changed, and looking through the svn and Trac history, I can''t see why. It appears that every call to #value now passes the same argument (the result of the #object method), which just duplicates what the function did before it took an argument. The reaso...
2007 Jan 24
0
ActionView::Helpers::InstanceTag#to_date_tag help
I''m trying to read through the code, hoping to find a way to custom style select boxes for a date_select and can''t figure out this code. Any help appreciated: <code> def to_date_tag() defaults = DEFAULT_DATE_OPTIONS.dup date = value(object) || Date.today options = Proc.new { |position| defaults.merge(:prefix =>
2006 Jul 08
10
A rant about parameters
...cted. I''m honestly seeking your advice here...how do you keep the various different ways methods, paritcularly ActionView helpers, can be called straight? Compounding the problem (and confusing me) was this method further down in the call stack: ---- module ActionView::Helpers class InstanceTag def to_country_select_tag(priority_countries, options, html_options) html_options = html_options.stringify_keys add_default_name_and_id(html_options) content_tag("select", add_options(country_options_for_select(value, priority_countries), options...
2007 Apr 09
4
How do i switch off error wrapping for a specific field?
...good practice in my eyes. Adding a class ''error'' to the field would be much nicer. My solution to the problem: build your own FormBuilder. Funny enough, i found no (nice) possibility to switch error wrapping off while using the FormHelper methods. As error_wrapping is a method in InstanceTag (and not of FormHelper), it is pretty hard to have a FormBuilder change its behaviour. One possibility is to define def initialize(object_name, object, template, options, proc) ActionView::Base.field_error_proc = lambda do |html_tag, instance|...
2009 Mar 15
5
Setting DEFAULT_FIELD_OPTIONS in Rails 2.3
Hi, I''m having some trouble overriding/defining the default_field_options constant without raising a warning. I''ve tried adding the code to do it in an initializer but that produces a warning (because the constant is already frozen), after some googling I found a recommendation to put it in the environment.rb file but that then that throws uninitialized constant ActionView
2006 May 18
2
attempt to override the ''tag'' method
I want to override the ''tag'' method in ActionView::Helpers::TagHelper to do some generalized error handling similar to the way scaffolding puts a red border around fields that fail validation. I''ve created a file lib/rails_patches/tag_helper.rb which contains the following. module ActionView module Helpers module TagHelper alias_method :orig_tag, :tag
2005 May 08
3
Overriding date_select in local project to use custom value rather than blank for starting option...
...de tricks? Should I? I''m still a bit new to the Ruby/Rails game, but I could see this being a bit of a pain since there is the ActionView class which has a Helpers Module within which there is a DateHelper module within which the date_select function is defined and which instantiates and InstanceTag class which has the to_select_tag function which I need to change. I supposed I could add javascript to my pages to insert the value later or just re-write the date_select function altogether, but I like the principle of being able to use these rails functions and make a few changes to them. I gu...
2006 Jul 24
2
InPlaceSelectEditor question
I''m attempting to use the example given in the Rails Recipes book chapter 2, to create a select drop-down using the InPlaceEditor function (modified to be InPlaceSelectEditor. The example given works (a country list drop-down), but I''m attempting to use it to display a list of items generated from an object in another table that is linked to the table that I''m editing.
2006 Jul 02
1
DRY? Why select_date and select_date?
Why select_date and select_date? I dont understand why having both (backward compat?). I also look that their source are different, one use the InstanceTag and others calls 3 select_(year, month, day) functions.
2006 Feb 01
4
Custom view helpers
...eth) ''some_string'' + self.get_instance_variable(obj).send(meth) + ''some_other_string'' end and I get "`person'' is not allowed as an instance variable name". How does Rails do that? I can see the text_field being Implemented like this: InstanceTag.new(object, method, self) but I have no idea what the InstanceTag class does or where I can find it. Many thanks in advance for any pointers! --Nicky
2006 Mar 20
1
FileColumn question
Can someone please help me with this. I have an Images table :- create table images ( id integer unsigned not null auto_increment primary key, image varchar(200) not null default '''' )ENGINE=InnoDB default CHARSET=latin1; And a car table :- create table cars ( id integer unsigned not null auto_increment primary key, user_id integer unsigned not null, title varchar(100) not
2013 Apr 10
1
Per form field_error_proc
...39;'s not so important, nobody really wants it :), but I don''t like it because of I think it isn''t good object desing. How complicated would be adding some extra option to formbuilder, like :form_field_error_proc, that can be propagated down to the ActiveRecord''s InstanceTag implementation? Or have you some other idea how to make this better? :) Best regards, Lukas -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to ruby...
2006 Mar 25
0
in_place_collection_editor
...l_for(options, *parameters_for_method_reference) url = "http://www.example.com/" url << options[:action].to_s if options and options[:action] url end end @controller = @controller.new end But I''m not able to use this setup as ActionView::Helpers::InstanceTag uses a method of CGI to get to the instance variable set on the controller: def object @object || @template_object.instance_variable_get("@#{@object_name}") end Also the structs don''t seem to behave as I expected them to (they don''t seem to respond to .send, nor am...
2006 May 18
3
populating array of text_fields from an array of model objects
I have in my view the following: <% 0.upto(@num_performances) do |idx| -%> <%= text_field ''performance'', ''city'', :index => idx, %> <%= text_field ''performance'', ''venue'', :index => idx, %> <% end -%> and in my controller I have: @performance = [Performance.new("city" =>
2006 Mar 18
1
Need help .. Rails Recipes, in_place_editor, selecting associations
...some stuff happening under the hood retrieving the original id when creating the instance tag. Would it be an option to overwrite the result? If so how to find which attribute? tag.inspect returns pages of variables. What to look for? Btw. What is the easiest way to open a referenced class, like InstanceTag, from within TextMate, when you don''t know what the source file is a called? Is a global search in the project the only option? I am at loss here what to do without rewriting most of the existing code relevant to in_place_editors? On the other hand though handling of associations in...