Displaying 20 results from an estimated 200 matches similar to: "Overriding ActionView::Helpers::InstanceTag::DEFAULT_TEXT_AREA_OPTIONS"
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
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
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 =>
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:
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
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 reason I bring this up is that the change breaks some of our
2006 Jul 08
10
A rant about parameters
Guys,
I''ve been chasing a problem with country_select for the past few hours
now. My intention was pretty simple...use the following line in a form:
<p><label for="country_region">Country</label>
<%= f.country_select :country_region, "United States" %></p>
However, for the life of me, I couldn''t get it to work. I kept getting
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
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.
Overriding date_select in local project to use custom value rather than blank for starting option...
2005 May 08
3
Overriding date_select in local project to use custom value rather than blank for starting option...
I would like to have a date control on a page and I would like a
behavior similar to what you get using date_select with the
:include_blank => true option where the first value in the dropdown is
"- Month -", "- Day -", or "- Year -" rather than a blank value for
the respective month, day, and year select fields.
I took a look at the ruby source for
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
2007 Apr 09
4
How do i switch off error wrapping for a specific field?
Hi, i have some issues with the default rails error wrapping. It wraps
errors in a div with class ''fieldsWithError'', which is not 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
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" =>
2007 Feb 28
1
Rails 1.2 Bug (?): to_text_area_tag
Hi all,
I''m fairly new to rails and thus might be missing something here, but I
think I have found a but in ActionPack. If this is not the right place
to post this, please let me know where. I discovered this issue while
attempting to use the lastest edge version of ajax_scaffold (mooey, MUI,
whatever it''s going to be called). I kept getting the error:
private method
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.
2013 Apr 10
1
Per form field_error_proc
Hi everybody,
I needed change field error rendering for some forms created with Rail''s
form builder. I found solution by changing ActionView::Base::field_error_
proc to own before form and changing it back after form rendered.
I don''t like this solution :) It''s not thread-safe (but it''s not so
important, nobody really wants it :), but I don''t like
2005 Dec 28
1
FCGI: warning: Object#id will be deprecated; use Object#object_id?
I am seeing some strange entries in my Apache error log from FCGI that I
don''t understand.
I have pasted one of the lines below.
Anyone seen this or know what might be going on?
[Wed Dec 28 08:35:50 2005] [error] [client 24.115.131.100] FastCGI: server
"/home/www/apps/appname/public/dispatch.fcgi" stderr:
/home/www/apps/appname/app/views/photo/fullsize.rhtml:26: warning:
2009 Oct 15
4
Getting the object in fields_for
I''m using the fields_for helper with accepts_nested_attributes_for
The System model has_many children.
If I do this in my haml template:
-form_for @system do |s|
=s.text_field :name
-s.fields_for :children do |child_fields|
=child_fields.text_field :name
all is fine. The fields_for iterates over all children and puts the
correct data in the fields.
But...what I
2006 Mar 18
1
Need help .. Rails Recipes, in_place_editor, selecting associations
Hi,
I am currently reading the Rails Recipes book and like the chapter on
providing your own in_place_editor for enumerations / selects.
I understood so far, or I believe that I understood ;-), how to do that
for a field that uses values only, like choosing from "red", "black",
"green". What I fail to understand is how to chose from associated objects?!