Displaying 20 results from an estimated 1000 matches similar to: "Setting DEFAULT_FIELD_OPTIONS in Rails 2.3"
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
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 01
3
Form helpers and overloaded methods - help!
Can someone explain why form helpers appear to bypass any model methods
I override for fields that are bound to database fields? It would be
great if someone could tell me how to force the form field, etc to call
the method instead of looking at the database / attributes collection.
Let''s say I have a column called ''price'' in my database table "books"
2009 Mar 16
4
Overriding ActiveRecord associations for special cases
Hi,
Does anyone know a good way to override AR associations to take
special cases into account. My current take is the example below which
allows the ''root'' user to access all products, but only works if I
remember to call it with a .all/.find or similar method:
''user.products.all'' instead of ''user.products''. Ideally I guess I want
to return a
2008 Aug 21
4
radio_button_tag - examining the selected value
Hi All
I have four radio buttons created like this
<%= radio_button_tag :answers, 1, false %> a <br/>
<%= radio_button_tag :answers, 2, false %> b <br/>
<%= radio_button_tag :answers, 3, false %> c <br/>
<%= radio_button_tag :answers, 4, false %> d <br/>
And then I have a link_to tag to invoke a controller function
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
2008 Jun 30
3
scaffold usage
is there anyway that scaffold would read the database and I don''t have
to specify any of the columns? it is really frustraiting specially when
you''ve got a lotta cols and tables! I''d like to use rails for an
enterprise app but not a toy app like all those apps in tutorials
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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
2008 Jul 07
6
MiniMagick, and processing thumbnails...
I have a requirement that can''t be that outrageous....
I want to be able to upload an image, and have multiple thumbnails be
created for each. Then, I want to post process each image (the main
image plus the thumbnails) to add borders. The trick is that the
borders need to be different for each image. I thought I could use
the after_resize handler, but when I try to add a border to
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
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 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
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.
2008 Jul 01
8
Scaffolding: Create, Edit, Destroy in admin area
Hi Community,
I''m currently trying to create a blog software in rails, but I''ve got
a problem:
I generated scaffolding for my articles and only want administrators
to write, edit or delete articles. So I wanted to move this parts to
another, secured controller. The one controller to display articles is
called articles :), the other is also called articles, but is located
in a
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 May 01
12
pagination in acts_as_ferret
I''m just wondering where I would put the pagination for search results
when using "acts_as_ferret".
At the moment my search code is..
def search
@query = params[:query] || ''''
unless @query.blank?
@results = Tutorial.find_by_contents @query
end
end
Cheers
SchmakO
--
Posted via http://www.ruby-forum.com/.
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
2003 Jun 16
1
dvd+rw+r for FreeBSD
I'm not subscribed to this list; but I read that
Matthew Dillon has ported the dvd+rw tools to FreeBSD.
I just compiled and installed the application; but I
can't burn to a DVD+RW on a Sony DRU-500A.
command: growisofs -Z /dev/acd0c -rl ./testfile
result: ":-( unable to CAMGETPASSTHRU for /dev/acd0c:
Inappropriate ioctl for device"
The DVD+RW website:
2008 Aug 20
2
Re: Stubbing out ThinkingSphinx for Rspec
Thanks Wolas!
Sorry if this seems like a newbie question, what am I supposed replace
the stubbed_method_name with?
Also, I came across the only thread on the Interwebs which seems to
cover this topic - it''s over a year old, but I think they have a
solution which could work around the issues you pointed out. However, I
couldn''t work out how to get their subbing approach to
2007 Feb 04
10
[AAF] remote indexing via DRb with acts_as_ferret
Hi!
Aaf trunk has undergone several major refactorings the last days, with
the result that you can now transparently switch your app from local
to remote indexing and back :-)
If you plan to scale your app to more than one physical machine, or
if you have problems with corrupted indexes and the like under high
load, you really should give this a try.
I wrote some documentation to get you