Displaying 20 results from an estimated 10000 matches similar to: "overriding form helpers"
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 24
2
named routes confusion
Hi,
I''m trying generate a URL from a named route like: namedroute_url(params...)
but the generated route is always coming out as the first match from the routes table.
The named route is defined inside a map.with_options block, but that shouldn''t matter should it?
dorian
--
--
I do things for love or money
2006 Apr 28
2
tests and login_engine
Hi there,
I just started writing tests today after some months of using rails (slap wrists).
I seem to be getting the hang of things, but I''m hitting a wall when it comes to functional_testing pages protected by login_engine/user_engine.
all my assertions come back with:
Expected response to be a <:success>, but was <302>
Is there a way I can login from within a test?
2006 Feb 01
4
Custom view helpers
Hi all,
I would like to write some custom helpers like the ones available as
form helpers text_field, text_area and the like. My first try was this:
custom_helper(obj, meth)
''some_string'' + obj.send(meth) + ''some_other_string''
end
Object and method are being passed as symbols like this:
custom_helper(:person, :name)
and Ruby rightfully complains that
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 Jan 25
2
form formatting
If I want to use fbml elements and rails tags, is there a way to do
within a fb:editor?
if I do:
<% facebook_form_for(:task, at task,:url => create_task_path) do |f| %>
Assign Task To: <%= fb_friend_selector %>
<%=f.text_field :ttype, :label=> "Title"%>
<%=text_field_tag :newrnumdays, ndays, :label => "# Days"%>
2006 May 16
3
wondering how to do some clever DRYing up
Hi there,
I''m now getting to the point in my rails app where I can use all of the nice basic features like AJAX and engines etc...
but, I want to get my hands a bit dirtier, whilst learning to DRY up my code a bit.
I''m using AJAX quite a bit to dynamically populate/edit/sort has_many relationships in forms, and consequently on a model with many has_many''s I end up
2006 Jan 23
2
require rmagick
Hello,
I''m trying to use rmagick in a helper script (for auto-generating image sizes) and I''m not sure where I should be calling ''require''.
currently I have:
require ''RMagick'' at the top of my controller:
class FilmsController < ApplicationController
require ''RMagick''
but that''s giving me an error:
2006 Mar 29
1
load testing
hi,
does anyone have any pointers for load testing an app running on apache2 with fastcgi?
I have an app running circa 3000 page requests per day, most of which are static pre-cached files and fastcgi seems to be coping well so far (crosses fingers) but I would like to be able to work out my server limit.
Currently I have the following in my apache conf:
FastCgiServer
2006 May 09
1
name_url in tests
Hi there,
I posted earlier asking about testing named routes in functional tests, but got no response, so I''m making my question less specific.
It seems from the docs that it''s possible to to test named routes in cases such as:
asserts_redirect_to name_url(:param => "whatever")
but I haven''t seen any mention of it being used with any other tests and I keep
2010 Jul 26
1
form date helper with text year
I have a date where the year range is more then I want to define in a
select_date scaffold generated year range.
My idea was to have the year entered as a text field and the month and
day using something like:
<%= select_month @person.born,:prefix => :person ,:field_name =>
"born(2i)" %>
<%= select_day @person.born,:prefix => :person , :field_name =>
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"
2006 Jun 07
1
railstidy
Hi there,
anyone had any trouble with railstidy?
I''m using it on 1.1.2 just to tidy my output and I get a server error everytime, but the only log message I get is:
FastCGI: incomplete headers (0 bytes) received from server "/var/rails/dev/public/dispatch.fcgi"
I have:
after_filter :tidy
def tidy
RailsTidy.filter(response)
end
...in my application.rb and I can get
2006 Jan 18
1
using unique varchar instead of id
Hi,
I just signed up so ''hello everybody''.
As the title suggests, I was wondering if there was an easy way to specify that I want all actions/controls to be based upon a particular parameter rather than :id (in this case :unique_name). I don''t :id to appear in URLs or elsewhere, I want it all to work from :unique_name.
It seems like something that I should be able to
2006 Mar 24
10
innodb vs myisam
Hi,
I have been using myisam tables in mysql with rails because my client will soon want fulltext searchable content, however when I migrated my development db from schema.rb all of the tables generated were innodb. I understand that I can override this, but also like the transactions and foreign keys of innodb. So 2 questions really:
1. are transactions in activerecord dependent on innodb or do
2006 Jan 23
11
mysql dates
does anyone know of a way to make the date_helper deal with mysql dates with 00 values in them?
I have lots of dates that are like the following:
2005-04-00
2005-00-00
and I need to set null values in a date_select for elements that are 00. These are valid dates in mysql.
In the absence of an immediate solution to the above, I''ve been trying to find out how InstanceTag.new works so I can
2005 Dec 19
0
ActionView::Helpers::FormHelper.text_field
Hi,
Is it possible to use the ActionView::Helpers::FormHelper.text_field with an
instance variable instead of a model. e.g.
In the controller:
def meth
@value = ''hi there''
end
In view:
<%= text_field ''value'', nil %>
It doesn''t work with what is above (doesn''t like the nil) and produces very
strange results replacing nil with
2006 May 19
2
1 Form for Model containing another Model??
Hi,
I can have a Person model with a "has_one :address_email" association,
then do the following in my controller:
@person = Person.new
@person.address_email = AddressEmail.new
But, when I have 1 form for "Person" in my view I can''t bind fields in
the @person.address_email object with text_field or text_field_tag
helpers without getting a "undefined local
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 Apr 28
1
beginner - default form values
I want to build a simple calculator with 1 form and a results page.
The form will be redisplayed with an error message upon an invalid value
entered.
I won''t be using any database/active record for this.
The problem i have is when i return to the form page i want to redisplay
the values already entered in the form fields.
Should i use text_field (which seems to be tied to a model) or