<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.1" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments for Say No To Milk, But Yes To Rails</title>
	<link>http://www.saynotomilk.com</link>
	<description>Milk doesn't do a body good.  Rails on the other hand...</description>
	<pubDate>Sun, 06 Jul 2008 12:28:45 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.1</generator>

	<item>
		<title>Comment on SilverStripe on Feisty by Pipes</title>
		<link>http://www.saynotomilk.com/archives/24#comment-479</link>
		<author>Pipes</author>
		<pubDate>Sun, 01 Jun 2008 01:12:31 +0000</pubDate>
		<guid>http://www.saynotomilk.com/archives/24#comment-479</guid>
					<description>Great write up. One slight adjustment for 7.10: 

sudo a2enmod mod_rewrite

Is: 

sudo a2enmod rewrite</description>
		<content:encoded><![CDATA[<p>Great write up. One slight adjustment for 7.10: </p>
<p>sudo a2enmod mod_rewrite</p>
<p>Is: </p>
<p>sudo a2enmod rewrite</p>
]]></content:encoded>
				</item>
	<item>
		<title>Comment on Rails Form Authenticity Token in Javascript by Glenn</title>
		<link>http://www.saynotomilk.com/archives/33#comment-471</link>
		<author>Glenn</author>
		<pubDate>Tue, 06 May 2008 22:39:12 +0000</pubDate>
		<guid>http://www.saynotomilk.com/archives/33#comment-471</guid>
					<description>yep.  the second way is the way to do it to avoid putting auth tokens where they needn't be.  There's probably some way to capture requests, check to see if they are posts, then and only then insert the auth token into the params but for now my problem is solved.</description>
		<content:encoded><![CDATA[<p>yep.  the second way is the way to do it to avoid putting auth tokens where they needn&#8217;t be.  There&#8217;s probably some way to capture requests, check to see if they are posts, then and only then insert the auth token into the params but for now my problem is solved.</p>
]]></content:encoded>
				</item>
	<item>
		<title>Comment on Rails Form Authenticity Token in Javascript by Glenn</title>
		<link>http://www.saynotomilk.com/archives/33#comment-470</link>
		<author>Glenn</author>
		<pubDate>Tue, 06 May 2008 22:28:38 +0000</pubDate>
		<guid>http://www.saynotomilk.com/archives/33#comment-470</guid>
					<description>gah the code tags didn't save me:
var tok_str="authenticity_token=" + "&#60;%= RAILS_ENV == 'test' ? '' : form_authenticity_token.to_s %&#62;";</description>
		<content:encoded><![CDATA[<p>gah the code tags didn&#8217;t save me:<br />
var tok_str=&#8221;authenticity_token=&#8221; + &#8220;&lt;%= RAILS_ENV == &#8216;test&#8217; ? &#8221; : form_authenticity_token.to_s %&gt;&#8221;;</p>
]]></content:encoded>
				</item>
	<item>
		<title>Comment on Rails Form Authenticity Token in Javascript by Glenn</title>
		<link>http://www.saynotomilk.com/archives/33#comment-469</link>
		<author>Glenn</author>
		<pubDate>Tue, 06 May 2008 22:27:03 +0000</pubDate>
		<guid>http://www.saynotomilk.com/archives/33#comment-469</guid>
					<description>The reason this doesn't work for my particular problem is that I'm not dealing with pages that have any hidden tokens already on them.  Right now I see two ways to potentially deal with the issue:

1 - my first idea - Have an Ajax.Responder function in the head of the applications base layout.  This would capture any (and all) Ajax requests and modify their parameters to append the authenticity token.  What is awful about it is that even GET requests will have the authenticity token when they don't need it but it's really not all that big of a deal.

2 - Use something like this:
&lt;code&gt;
var AJ = {
  rails_gen_token:function() {

    var tok_str="authenticity_token=" + "";

    return tok_str

  }
}
&lt;/code&gt;

And manually (or via a nice regex gsub ;) find all Ajax requests in the js files and prepend the generated token to their parameters.  

I think the second one will actually work and I'll try it tonight then report back with results.</description>
		<content:encoded><![CDATA[<p>The reason this doesn&#8217;t work for my particular problem is that I&#8217;m not dealing with pages that have any hidden tokens already on them.  Right now I see two ways to potentially deal with the issue:</p>
<p>1 - my first idea - Have an Ajax.Responder function in the head of the applications base layout.  This would capture any (and all) Ajax requests and modify their parameters to append the authenticity token.  What is awful about it is that even GET requests will have the authenticity token when they don&#8217;t need it but it&#8217;s really not all that big of a deal.</p>
<p>2 - Use something like this:<br />
<code><br />
var AJ = {<br />
  rails_gen_token:function() {</code></p>
<p>    var tok_str=&#8221;authenticity_token=&#8221; + &#8220;&#8221;;</p>
<p>    return tok_str</p>
<p>  }<br />
}<br />
</p>
<p>And manually (or via a nice regex gsub <img src='http://www.saynotomilk.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> find all Ajax requests in the js files and prepend the generated token to their parameters.  </p>
<p>I think the second one will actually work and I&#8217;ll try it tonight then report back with results.</p>
]]></content:encoded>
				</item>
	<item>
		<title>Comment on Rails Form Authenticity Token in Javascript by nathan.sutton</title>
		<link>http://www.saynotomilk.com/archives/33#comment-468</link>
		<author>nathan.sutton</author>
		<pubDate>Tue, 06 May 2008 21:28:27 +0000</pubDate>
		<guid>http://www.saynotomilk.com/archives/33#comment-468</guid>
					<description>This is actually doing just that, if I understand you right.  You would use this for ajax requests that were not made by rails helpers, but were made in hand-written javascript files.

If you're talking about doing it for every Ajax request across a site without having to use a helper like I use here, then I'm afraid you might have to modify Prototype's Ajax library to allow for it.  I'm not sure though, and that's dangerous to do.

Keep us posted, especially if you figure out a solution.  If I come across something that works, I'll update this.</description>
		<content:encoded><![CDATA[<p>This is actually doing just that, if I understand you right.  You would use this for ajax requests that were not made by rails helpers, but were made in hand-written javascript files.</p>
<p>If you&#8217;re talking about doing it for every Ajax request across a site without having to use a helper like I use here, then I&#8217;m afraid you might have to modify Prototype&#8217;s Ajax library to allow for it.  I&#8217;m not sure though, and that&#8217;s dangerous to do.</p>
<p>Keep us posted, especially if you figure out a solution.  If I come across something that works, I&#8217;ll update this.</p>
]]></content:encoded>
				</item>
	<item>
		<title>Comment on Rails Form Authenticity Token in Javascript by Glenn</title>
		<link>http://www.saynotomilk.com/archives/33#comment-467</link>
		<author>Glenn</author>
		<pubDate>Tue, 06 May 2008 21:09:00 +0000</pubDate>
		<guid>http://www.saynotomilk.com/archives/33#comment-467</guid>
					<description>This is a nice way to do it when you can access the form element with the hidden token.  What about when you are defining your requests outside of the views in javascript files?

I'm trying to come up with a way to globally prepend a valid authenticity token to ajax requests (using Ajax.Options most likely) but can't find a good way to accomplish this.</description>
		<content:encoded><![CDATA[<p>This is a nice way to do it when you can access the form element with the hidden token.  What about when you are defining your requests outside of the views in javascript files?</p>
<p>I&#8217;m trying to come up with a way to globally prepend a valid authenticity token to ajax requests (using Ajax.Options most likely) but can&#8217;t find a good way to accomplish this.</p>
]]></content:encoded>
				</item>
	<item>
		<title>Comment on Rails Form Authenticity Token in Javascript by Diver</title>
		<link>http://www.saynotomilk.com/archives/33#comment-463</link>
		<author>Diver</author>
		<pubDate>Sat, 26 Apr 2008 13:23:24 +0000</pubDate>
		<guid>http://www.saynotomilk.com/archives/33#comment-463</guid>
					<description>Thank you, guy! You're solved my problem!</description>
		<content:encoded><![CDATA[<p>Thank you, guy! You&#8217;re solved my problem!</p>
]]></content:encoded>
				</item>
	<item>
		<title>Comment on Safe Nils and Try by Justin Blake</title>
		<link>http://www.saynotomilk.com/archives/34#comment-437</link>
		<author>Justin Blake</author>
		<pubDate>Thu, 06 Mar 2008 09:35:34 +0000</pubDate>
		<guid>http://www.saynotomilk.com/archives/34#comment-437</guid>
					<description>Wow, very cool. I hit this in my newsreader immediately after finding try() linked from rubyinside. This is much better. Nice work.</description>
		<content:encoded><![CDATA[<p>Wow, very cool. I hit this in my newsreader immediately after finding try() linked from rubyinside. This is much better. Nice work.</p>
]]></content:encoded>
				</item>
	<item>
		<title>Comment on Rails Form Authenticity Token in Javascript by Lindsay Holmwood</title>
		<link>http://www.saynotomilk.com/archives/33#comment-430</link>
		<author>Lindsay Holmwood</author>
		<pubDate>Wed, 13 Feb 2008 13:05:02 +0000</pubDate>
		<guid>http://www.saynotomilk.com/archives/33#comment-430</guid>
					<description>Very handy! Thanks for posting this. :-)</description>
		<content:encoded><![CDATA[<p>Very handy! Thanks for posting this. <img src='http://www.saynotomilk.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
				</item>
	<item>
		<title>Comment on Javadoc and Ant by Johnny Redbeard</title>
		<link>http://www.saynotomilk.com/archives/18#comment-423</link>
		<author>Johnny Redbeard</author>
		<pubDate>Wed, 06 Feb 2008 22:33:25 +0000</pubDate>
		<guid>http://www.saynotomilk.com/archives/18#comment-423</guid>
					<description>Yeah, I just threw in the extlibs attribute and all those warnings went away.
Thanks for the info and have a good one.
Build on and build strong.</description>
		<content:encoded><![CDATA[<p>Yeah, I just threw in the extlibs attribute and all those warnings went away.<br />
Thanks for the info and have a good one.<br />
Build on and build strong.</p>
]]></content:encoded>
				</item>
</channel>
</rss>
