Displaying 20 results from an estimated 2000 matches similar to: "Accessing request.host in UserMailer"
2007 Apr 22
7
Getting a complete URL from Rails
Hello,
I''m sending out an e-mail message to new users of my service. I want
to send a particular link in this e-mail but I can''t figure out how to
get a complete URL from the url_for method. Is there a way to do this
without manually setting the host name?
Thank you,
-- Miles
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are
2008 Oct 21
6
detecting width overflow in serialized column with mysql
So I''ve got an ActiveRecord model pointing to a MySQL db, with an
auto-serialized column ("serialize :columnName").
Thing is, MySQL, depending on how it''s configured (like, by default),
has a bad habit of just truncating your data if it''s too wide for the
column, with no error raised. Yeah, I can probably reconfigure MySQL
and/or my AR connection to it. But
2009 Feb 19
3
Associated child records not created on creation of a parent.
I am trying to create a record with association. Within the create
method, I would also like to pre-populate dependent (has_many) records
from a template in the database.
The child records are <u>mysteriously rolled back </u> if I insert
them in a loop. If I try to insert a single child record, it works.I
have read the books and tried to google my way out of this but am at a
dead
2008 Dec 20
4
uninitialized constant BooksController::Books
hi new to rails ...
wat does it means...
uninitialized constant BooksController::Books
/usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:102:in
`const_missing''
app/controllers/books_controller.rb:5:in `index''
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are
2006 May 04
3
Problem using url_for
I''m trying to generate a URL of the form
controller/action?id=<id>&type=<type>. My code looks like this:
url_for(:controller => ''content'',
:action => ''get_resource'',:id => item[''Id''],:type => item[''type'']
)
The url I end up with looks like this:
2008 Dec 13
3
session In the model
Hi
i have the model SDTicket which has a field modified_by_id and it has
to take data from session[:id] Now this SDTicket model has many
associated models like Activity one of them So when ever an activity
happens then also the value in session[:id] is to be go to
modified_by_id field
SDTicket has_many activities
Activity belongs to SDTicket
So for that what I am trying is in Activity
2008 Dec 13
3
how to do "special queries" ala The Rails Way on "associated" conditions?
I have the following in a model class:
class Game < ActiveRecord::Base
has_many :player_stats
has_many :players, :through => :player_stats
def visitor_stats
stats = []
player_stats.each do |stat|
stats << stat if stat.player.team.team_code ==
self.visiting_team_code
end
stats
end
def home_stats
stats = []
player_stats.each do |stat|
stats << stat if
2007 Dec 23
1
Rails: possible routing discrepancy
Hey all, I''m seeing a strange behavior in my spec that I can''t
account for. I''ve got a route that looks like this:
map.writing \
''/writing'',
:controller => ''abstracts'', :action => ''index'',
:index => { :select => ''all'' }
and I have template code that looks like this:
<br
2008 Nov 12
5
dynamic condition for has_one and eager loading issue
Hi,
I ve defined the following relation in one of my models with a dynamic
where condition:
has_one :selection,
:foreign_key => ''object_id'',
:conditions => ''selection_type = 1 and account_id = #
{self.send(:account_id)}''
That works perfect, however when I try to eager load that relation I
am getting the following error when doing a
2008 Sep 02
3
Unable to set default_url_options[:host] for Action Mailer
I am attempting to provide ActionMailer with the request host needed to
generate a url.
Here is my code:
In config/environments/development.rb
config.action_mailer.default_url_options = { :host =>
"development_url.com" }
and in config/environments/production.rb
config.action_mailer.default_url_options = { :host =>
"production_url.com" }
When I run the above code
2009 Nov 11
4
host_with_port in config/environment.rb
Hello everyone... i''m Italian, sorry for my poor English, but I find
myself in difficulties with this method.I don''t need to redirect the
logout of rubycas in a host other than localhost... when the decoy in
"config/environment.rb" of course tells me ''method ''host_with_port''
undefined''... I looked in the folder of ruby and i saw that
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 Mar 04
13
file_column
Restricting size of an uploaded file, is how is that possible? If I
do not want a user to upload a file larger than X bytes, can it
easily be done?
If I also would like restrict the types of files that can be
uploaded, how may I do so?
Thank you,
Sharkie
2008 Jun 15
11
[PATCH] helper to create fb css stylized table
I attached a rails helper implementation of the fb_table described here:
http://wiki.developers.facebook.com/index.php/Facebook_Styles
I included testing and comments. I hope you find it useful.
Curiously, it''s really a small extension of FBML.
Richard
-------------- next part --------------
Index: test/rails_integration_test.rb
2009 Feb 15
3
conditions on association include, hacky but more or less solved
Hi all,
I just finally figured out how to get 2.2.2 to do this, and thought
I''d share in case others run into the same thing.
The situation is a find with associations, but the tricky part is that
the association shouldn''t always be loaded. This is similar to putting
a condition on a has_many association in a model, but the condition is
dynamic rather than predefined.
The
2010 Mar 10
6
Email section
Sir , I want to implement email section in ma web application..
so i found the method ''server_setting'' for it...
Following is the method:
config.action_mailer.server_settings = {
:address => "smtp.gmail.com" ,
:port => 25,
:domain => "gmail.com" ,
:authentication => :login,
:user_name => "manish" ,
:password =>
2008 Apr 20
2
open_id_authentication - authenticate_with_open_id
I''m using the open_id_authentication plugin just like the README
says. However, when I submit my openid_url, the
authenticate_with_open_id method gives me the error below.
vendor/plugins/open_id_authentication/lib/open_id_authentication.rb:
150:in `+''
vendor/plugins/open_id_authentication/lib/open_id_authentication.rb:
150:in `requested_url''
2007 Mar 19
2
Controller url_for modifies request object?
Hi,
In my controller, I do something like this:
MyMailer.deliver_signup_notification(url_for(:subdomain =>
account.subdomain, :controller => ''hello''))
And a few lines later:
redirect_to :action => ''index''
Much to my confusion, the redirect routes me to the subdomain used in
the url_for. I''ve tried
redirect_to :action =>
2009 Nov 10
10
Un-recognised routes that do exist, using namespaces & subdomain checking
I''m getting really cheesed off with RSpec not matching some of my
routes when controller testing when I have subdomain checking
(courtesy of subdomain-fu) on namespaces. These routes appear in the
rake routes output, and work fine via HTTP requests .
The really annoying thing is it''s working fine for routes that aren''t
at the root of the namespace.
E.g. say I have
2009 Feb 08
2
SocketError in EmailController#correspond
SocketError in EmailController#correspond
getaddrinfo: no address associated with hostname.
Please see above, these are the errors i get when i try to email a user
on my networking site. Can you help please.
Actionmailer address = smtp.vodafone.ie
Below is code used for the email controller in
apps/controllers/email_controller.rb There doesnt seem to be any code
missing. Can someone help with