Displaying 20 results from an estimated 500 matches similar to: "DRY Up Lots o'' Mailers"
2006 Apr 22
3
rjs woes, any hints?
I''ve pared my rjs experiment down to what seems a bare minimum. When I click
on my link_to_remote, the rjs executes, returns the correct javascript to
the browser, but it doesn''t update the div I''ve specified. What appears to
be coming back from the controller is:
Element.update("my_form", "hello, rjs");
I''m tearing my hair out.
2007 Dec 08
2
Assigning submit handler to form
Hi folks,
A quick question for somebody. I''m adding a simple validation JS to my
form by attaching it like so:
$(''my_form'').observe(''submit'', function(e) { return
view_ns.validate_form(Event.element(e)); });
The validate_form() function returns true or false. But regardless of
it''s return value, the form is always submitted. ''sup wi
2008 Jul 27
2
Rails Cookbook review
Guys:
Stuck at the mall today, and just had to crack Rails Cookbook, by O''Reily. It
had a recipe for accepting dynamically created forms. The sample output looked
like this (reconstructed):
p params[:my_form]
> ["1-1" => 0, "1-2" => 0, "1-3" => 0, "2-1" => 0, "2-2" => 0,
"2-3" => 0,
2011 Sep 13
3
Accessing Rails helper method with_output_buffer
Hi all,
I cannot figure out how to correctly use the with_output_buffer helper
method (located in ActionView::Helpers::CaptureHelper) inside a custom
FormBuilder.
Below follows a simplified example.
I''m trying to achieve the following behavior in an ERB as suggested in
the form_for helper docs in the Rails source:
==========
<%= form_for @object, :builder => MyFormBuilder do
2006 Jul 26
1
my "observer" is blind
Any body have an idea why my first attempt to use "observe_field" isn''t
working?
<%= start_form_tag(:name => ''my_form'', :controller => ''boo'' , :action =>
''ya'') %>
<%= radio_button_tag(''foo'', ''true'', checked = true) %>
<%= radio_button_tag(''foo'',
2006 Feb 16
0
Shouldn''t mailers be controllers?
Anybody else think that mailers are more like controllers than models?
After all, they even have associated views. And they''re not associated
with any data (like a database table). Furthermore, if they were
controllers, you could use url_for in their templates!
Joe
--
Posted via http://www.ruby-forum.com/.
2006 Feb 16
1
runner: url_for with mailers impossible
I created a runner script to send a newsletter. I found this hack where
you pass a controller and specify a helper:
http://wiki.rubyonrails.org/rails/pages/HowtoUseUrlHelpersWithActionMailer
But in a runner script there is no controller to pass. So, it looks like
it''s impossible to use url_for in the mailer template this way.
Another way around the no url_for problem is to pass the
2006 Feb 17
2
Dealing with *a lot* of Mailers
Anybody here deal with "a lot" of ActionMailers ?
I have a lot of places within my application that send out emails to various
parties.
My /views directory has a directory for each type of mail... ie:
new_user_mailer/
forgot_password_mailer/
...etc
The /views directory is getting quite full of directories because of this,
and I''ve tried working some
magic to get the views
2010 Dec 11
0
Rails 3 - Delayed_Job (collectiveidea), trying to Delay Mailers - Error: NoMethodError (undefined method `delay' for UserMailer:Class):
Hello, I have the following in an observer:
UserMailer.delay.msg_notification(record)
In user_mailer.rb
class UserMailer < ActionMailer::Base
...
def msg_notification(record)
mail(
:to => "#{record.user.email}",
:subject => "Notification"
)
end
..
end
But this errors with:
NoMethodError (undefined method `delay'' for
2006 Jun 20
4
Mailers and records MX
I've installed bind on centos 4.3.. This is a part of my config file:
example.com. IN MX 10 mail.example.com.
example.com. IN MX 15 mail1.example.com.
example.com. IN MX 20 mail2.example.com.
mail.example.com. IN A IP
mail.example.com. IN A IP
2008 Mar 31
2
Rails and Partials
Excuse my ignorance on partials but.....
I am trying to use partials to create a uniform display box built with
html tables. The only way I have thought about accomplishing this is to
create two partials:
_start_box.erb
----------------
<table id="box" width="<%= width %>"><tr><th><%= h(label_text)
%></th></tr><tr><td>
2006 May 09
2
[Prototype] Why doesn''t calling submit() on a form result in the execution of the onsubmit event handler?
Hi,
Is it normal that a call to $(''some_form'').submit() doesn''t result in the
execution of an onsubmit event handler on ''some_form''?
Thanks,
- Rowan
--
Morality is usually taught by the immoral.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2005 Dec 28
2
form reset after successful form submission
hi,
what''s the way to reset the form generated by the form_remote_tag
after the successful submission of the form?
thanks
2006 Aug 04
4
DRY DRY DRY
Hello everyone!
Ive been on rails for the last month or so and really enjoyed this
framework.
However its very hard to find documentation on how to do things right!
For example every beginner after a while realizes that having similar
CRUD actions in every controller and views for them is not DRY at all!
Few days ago I found http://dereksivers.com/rails-shared-controller.html
I quite like his
2007 May 30
0
DRYing up controller tests and mailer tests using superclasses
Hi!
Currently both, the controller/functional tests and mailer tests,
contain a lot of cruft. I''ve created two superclasses to DRY them up a
bit. Here are some examples how tests using those superclasses will
look:
http://pastie.caboo.se/66139
Ticket with the patch:
http://dev.rubyonrails.org/ticket/8521
Known issues:
* Since we don''t explicitly setup the @request and
2007 Sep 22
0
How to DRY up controller action spec with different params.
I tend to write a fresh description block for every change in the parameters
for that specific action, because I hate conditionals in the example
describtion, e.g.:
describe SomeController, "handling GET /path/with/param/3" do
it "should do this"
it "should not do this if"
it "should still do that in both cases"
end
Seperate description blocks keep
2006 Aug 06
4
DRY Scaffolds
I''ve got 8 scaffolds, each one can be considered an ''item'', such as a
blog, photo, etc. Using login_engine and user_engine, I list all blogs
belonging to a user by saying:
@user=session[:user]
@blogs=@user.blogs.find(:all)
but then let''s say I want to create an option where I want to slice it
differently:
@user=session[:user]
if @someOption ==1
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 Jul 17
1
How to DRY up validates_presence_of
Given the case of validating the presence of an attribute and then
performing other tests on said attribute, how do you go about not having
to check for nil in the other tests?
Example:
validates_presence_of :start_date, :end_date
validate :validate_start_date_before_end_date
def validate_start_date_before_end_date
# without this check an exception will be thrown on access to the
2006 Jul 28
1
How to set environment specific config variables DRY-ly
Sorry, search is down on the forum, so I don''t know if this has been
posted elsewhere.
I have some config variables that I want to have set in all
environments, and overridden in production.
What I want to do is put this in my config/environment.rb
SOME_CONFIG = 555
And then override it in config/environments/production.rb as:
SOME_CONFIG = 333
Problem is, using constants I