Displaying 20 results from an estimated 50000 matches similar to: "Overriding rails helpers?"
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 Mar 22
2
Proposal for Ruby on Rails for the SOC.
Hi list,
I''m sorry to come here talking about this (since I realize you have
many, far better things to do, but I''d really like your feedback on an
idea I have for the summer of code.
I''d like to work with the guys at Ruby Central on implementing a
feature for Ruby on Rails, and since you guys are the best source of
information on the subject, I''d like to ask
2006 Jun 01
9
@model.errors.empty? => true; @model.valid? => false
Hi,
So, how can the situation described in the subject come to be?
In other words, what could be invalidating the model, yet not
generating an error?
thanks,
jh
ps.
here''s the breakpoint session paste:
irb(#<#<Class:0xb72eec00>:0xb72eeb10>):003:0> @project.errors.empty?
=> true
irb(#<#<Class:0xb72eec00>:0xb72eeb10>):004:0> @project.valid?
=> false
2011 Mar 16
1
Help overriding rescue_action_in_public in Rails 3
In Rails 2.3.x, you can override render_optional_error_file like so:
# ApplicationController.rb
protected
def render_optional_error_file(status_code)
render :template => "errors/500", :status => 500, :layout => ''application''
end
However, Rails 3 no longer has render_optional_error_file. Instead, you need to overriderescue_action_in_public, which I do:
2006 Mar 07
0
Overriding date helpers in a logical way
Short story: I need to use a different style of inputs to enter
datetimes. What I want is to be able to implement these while still
retaining the niceties of the built-in input helpers, like
ActiveRecord error handling and automatic reconstitution of a single
Date object from multiple form elements. What''s the best way to go
about this?
Long story: My form has one standard month
2006 Feb 16
3
Breakpoints completely fail to work
I did as I was told: add "breakpoint" to an action, start script/server,
start script/breakpointer, then go to the action in the browser.
Absolutely nothing happens, on either side. I''ve tried every variation
of starting what when I can think of, I''ve specified ports, I''ve done
all I can think of, but never once have I gotten the fabled irb prompt
that
2006 Jun 01
0
overriding form helpers
Hi there,
I''ve been trying to override the text_field helper with a version in my application helper.
Whenever I try and call it from a partial I get the error:
"uninitialized constant InstanceTag"
I can override the text_field_tag no problem. But there''s lots of stuff I don''t understand in text_field.
All I really want to do is set some common options for
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 Apr 09
5
Peculiar Hpricot error in Rails app
Hi,
I have been stumped by this error Hpricot is generating in my rails
app. The error looks like this:
$ script/console
Loading development environment (Rails 2.0.2)
>> str = ''<p>lorem ipsum <a href="http://dolor.com/">dolor</a> sit amet.</p>''
=> "<p>lorem ipsum <a href=\"http://dolor.com/\">dolor</a>
2005 Aug 25
4
how to use ruby debugger instead of irb from script/breakpointer
Hello -
I would like to use the ruby debugger instead of irb
for a breakpoint enabled by script/breakpointer
in order to step through some code.
How do I do that?
Aaron
2006 Nov 10
2
Testing with foreign keys
I''m looking for a plugin/whatever for preloading fixtures, to run
tests with FKs defined.
Specifying load order just doesn''t work for me, I need to purge the
test db, load all fixtures, and only then create the FK constraints.
Any suggestions?
Isak
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
2006 May 19
7
AR transactions and isolation levels
I''m trying to create a sequence with no gaps in my db (contrived
example, but should work out the same as my real one), and believe
db-managed transactions are the way to go about this.
It''s my first real ''go'' at transactions, so I may be mistaken about
how things really work.
Anyway.. Consider this example code:
Class Invoice < ActiveRecord::Base
def
2006 Mar 14
2
RDT and breakpointer
How to get Rails'' script/breakpointer work in RDT 0.7 in Eclipse 3.1.2?
I''m new to Rails and have gotten breakpointer working in a csh on Fedora
Core 4. Also, the RDT setup works for breakpoints set in straight Ruby
code. I''m trying
http://www.napcs.com/howto/railsonwindows.html#setupbreakpointer. But a
breakpoint set in Eclipse doesn''t get hit at all.
2005 Nov 18
2
Migrate Ubuntu Rails App to Fedora?
I developed a small RoR app on my Ubuntu laptop and I just tried to migrate
it to my "production" box which is Fedora FC3. I moved the entire rails
app. I received this error when I tried to get the first page:
[2005-11-17 15:36:00] INFO WEBrick::HTTPServer#start: pid=32546 port=3000
192.168.0.61 - - [17/Nov/2005:15:40:01 EST] "GET /freesql HTTP/1.1" 200 0
- ->
2008 Jan 23
1
cgi escaped basic auth data in ActiveResource?
ActiveResource basic auth currently breaks when certain chars are used
in the user name and/or password field, e.g. ''@'' as part of the user
name.
I created a ticket on the issue[1], but closed it again as I''m not
sure where the responsibility really belongs. It''s a showstopper for
us, though.. Thoughts?
[1] <http://dev.rubyonrails.org/ticket/10902>
2006 Feb 12
4
[newbie] if expression "weirdness"
Ok first i am running linux with lighttpd and apache proxy''ing to the
lighttpd process.
ruby version is
ruby 1.8.4 (2005-12-24) [i686-linux]
def test
@count = Question.count
if(@params[:id]) then
breakpoint()
if (params[:id].to_i > @count) then
redirect_to :action => ''finish''
end
end
end
this is a stripped down version of
2006 May 16
2
Model layer access control
I already have a simple role based access control system (User, Role,
Privilege, Client) in place for my web layer, which checks
User.authorized?(controller, action, client) from a before filter.
What do you think about using this method for auth checks on the model
layer as well, only with made up controller/action strings? (e.g.
"model::Period", "close")
A bit simplistic
2011 Feb 15
1
samba authenticates only against the primary group of a user?
Hello everyone!
I seem to be have a bit of a problem setting up a few network folders for a
my office on a Qnap storage device running Samba -v3.5.2. So I ask:
when the 'write list' of a share contains ONLY groups, and a user tries to
log on to that share, then samba authenticates against the primary group
only of that user only??
Here is the example that fails:
-the user is
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 Jun 15
0
Localization of the date_select -helper
I could use some help with translating month names for the date_select
helper using gettext.
Think my best bet would be to override the
ActionView::Helpers::DateHelper.select_month method once gettext is
initialized, which is done by a before_filter in ApplicationContext,
but have no idea how I would go about that.
Any suggestions appreciated,
Isak