Skip to main content

Posts

Showing posts with the label ruby-on-rails

Testing view helpers

I'm currently working on a Rails plugin used for generating iPhone specific HTML meta-tags. I'm trying to use ActionView::TestCase for unit tests but keep getting the same error. See file contents and error below. Any ideas or help would be much appreciated. test_helper.rb require 'rubygems' require 'test/unit' require 'active_support' require 'action_view' require File.join(File.dirname(__FILE__), '..', 'lib', 'iphone_helper') iphone_test_helper.rb require 'test_helper' class IphoneHelperTest < ActionView::TestCase test 'br' do tag = tag('br') assert_tag_in tag, '<br />' end end error RuntimeError: In order to use #url_for, you must include routing helpers explicitly. For instance, `include Rails.application.routes.url_helpers

Playframework vs Ruby On Rails

Yet another LanguageX vs LanguageY question.... Currently I have a bunch of apps built on playframework . For the most part I love it. Moving from PHP a few years ago was almost a religious experience -- an actual functional orm, much less boiler plate code, stuff just worked, etc. I still have a website running on a a shared hosting service thats built with PHP+ CodeIgniter . Recently I've been adding some features to this site and have been thinking about porting it to either Ruby on Rails or Playframework. So far though, nothing about rails has really blown me away. It seems like it has pretty much the same featureset as playframework. I like ruby's terseness, and things like blocks, but again for the most part there's been nothing about the language itself that has made me go "oh wow this is 1000x better than java/php/c/whatever!" In fact, some parts actually kind of rub me the wrong way -- I prefer strongly-typed languages for example. My questio

<script type=&hellip;></script> works but javascript_include_tag doesn"t

I put jquery.validate.js in my public/javascript folder and I called <%= javascript_include_tag 'jquery.validate' %> in the header but I get this in the chrome debugger: Uncaught TypeError: Object [object Object] has no method 'validate' I can see jquery.validate.js?1317943298 under javascripts/ in the chrome debugger. On the other hand, when I add this right before I call validate(), <script type="text/javascript" src="http://jzaefferer.github.com/jquery-validation/jquery.validate.js"></script> it works. I see jquery.validate.js under jquery-validation/ as well as jquery.validate.js?1317943298 under javascripts/ in the chrome debugger. Both files are identical. What's going on here?

jQueryUi tabs loaded dynamically in jQueryUi dialog don&#39;t work

I am having a Ruby and Rails application. I am loading a form using Ajax. The form is an existing rails view. The form in turn contains jQueryUi tabs. Unfortunately the tabs are not shown when the form is loaded in the jQuery dialog box. Here is the code for the dialogbox $('#create_candidate').click( function(e) { var url = $(this).attr('href').replace('?','.js?'); var new_candidate_dlg = $('<div id="new_candidate_dlg">Loading form ...</div>'); new_candidate_dlg.load(url); new_candidate_dlg.dialog({ autoOpen:false, width: 'auto', height: 'auto', modal: true, close: function() { $('new_candidate_dlg').remove(); }, open: function() { $('#tabs').tabs(); } }); new_candidate_dlg.dialog('open'); e.preventDefault(); }); Strangely, If I change the code like following, the tabs do appear bu