search for: urlhelper

Displaying 20 results from an estimated 52 matches for "urlhelper".

2006 Jan 09
1
testing UrlHelper in ActionMailer
Hi All, So I found a helpful web page that explained how I could use things like url_for in my mails: http://wiki.rubyonrails.com/rails/pages/HowtoUseUrlHelpersWithActionMailer However, I can''t test them properly. The problem is that when I create a controller in my unit tests and pass it into the ActionMailer, it''s not a real controller, set up as a controller is when it is instantiated via an http request, so variables inside the cont...
2006 Jan 12
3
url_for in tests
Hi there, I''ve added an extra bunch of testing features for doing in-browser testing with Selenium, and am having quite a time figuring out how to use url_for with having a controller object present. I''ve tried using ActionController::Base.url_for and ActionView::Helpers::UrlHelper.url_for but haven''t been able to get something that works. What I want to be able to do is call url_for(:controller => ''test'', :action => ''index'') and have the URL string returned, anyone know how to do this? Cheers, Jonathan. ------------...
2009 Jun 11
4
Using view helpers and route helpers in a model
Hi there, I am trying to get something working and its driving me crazy. I have been looking around for solutions to getting view helpers working in models and for the most part I find this solution. Add the following in the model you want to use them in include ActionView::Helpers::UrlHelper include ActionController::UrlWriter However, when I try something like link_to(polymorphic_path(@node)) I get an error. "can''t convert String into Hash" This is because ''link_to'' uses ''url_for'' which is a method that both UrlHelper and Ur...
2006 Jan 03
7
link_to an external url ?
Simple question. Is it possible to generate a link like <a href="http://www.google.com" target="_blank" >google</a> with the link_to function ? Thanks
2006 Jan 18
5
redirect_to with an anchor, how ?
Hello, I try this : redirect_to :action => ''infos'' , :id => params[:id] , :show => "comments#a" i want this : .../infos/15?show=comments#a but I have this : .../infos/15?show=comments%23a Someone could tell me how generate an anchor link ? Thanks
2009 Jan 06
1
How to access text helper and url helper methods in model
Hi, I want to access TextHelper and UrlHelper methods in my model so how i am able to access it ? I was included following helper in my model but still it is not working? also for accessing these helper method w need to give external reference? E.g. class Xyz include ActionView::Helpers::TextHelper...
2006 May 21
6
Is there a way to call helper methods in a controller?
...string = link_to "some_url", :controller => "home", :action => "command" end end link_to is an ActionView helper method and it seems that I couldn''t access the method in the controller even if I used the complete namespace... ActionView::Helpers::UrlHelpers::link_to I''ve also done some testing in irb and it says the method is undefined.. >> ActionView::Helpers::UrlHelper => ActionView::Helpers::UrlHelper >> ActionView::Helpers::UrlHelper::link_to NoMethodError: undefined method `link_to'' for ActionView::Helpers::Url...
2006 Apr 19
3
Custom Form Buttons
Is there a way to deliver options for a custom form button to the submit function? As in: <input type="image" name="submit" src="image.jpg" width="126" height="18"> -- Posted via http://www.ruby-forum.com/.
2006 May 11
3
can''t call link_to from within a model class
...lass definition isn''t available. Remember to require the classes for all objects kept in the session. (Original exception: undefined method `link_to'' for User:Class [NoMethodError]) I''ve also tried doing: class User < ActiveRecord::Base include ActionView::Helpers::UrlHelper ... but calling link_to produces the same error.. I''ve also tried: validates_uniqueness_of :email, :message => "address has already been taken. If you''ve forgotten your password, please click " + ActionView::Helpers::UrlHelper:link_to(''here'',...
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
2006 May 11
3
How do i open link to a new winow?
Pretty simple question right? can''t seem to figure it out. -- Posted via http://www.ruby-forum.com/.
2006 May 30
1
Posting a form to a secure target?
All, If I want my form action to be a secure target, what is the best way to go about doing that? I''m trying to do: <%= start_form_tag( { :protocol => ''https://'', :host => request.host + '':3001'', :action => ''login'' } ) %> in my view, but this doesn''t seem to generate a URL with https:// and my SSL host in
2006 Jan 12
0
testing
I''m looking for a good way to make all of Rails'' inbuilt helpers available to my custom Helper while I''m testing it. The Helper I''m testing is EditorHelper. EditorHelper itself relies on some of Rails'' inbuilt Helpers, such as JavaScriptHelper and UrlHelper. These are automagically available when called on within an ERB template, but not when called by my EditorHelper inside a unit Test. I can manually include each of the required Helpers in my editor_helper_test file: ... require ''action_view/helpers/url_helper'' module EditorHelpe...
2006 Jan 13
0
testing Helpers
...9;)] I''m looking for a good way to make all of Rails'' inbuilt helpers available to my custom Helper while I''m testing it. The Helper I''m testing is EditorHelper. EditorHelper itself relies on some of Rails'' inbuilt Helpers, such as JavaScriptHelper and UrlHelper. These are automagically available when called on within an ERB template, but not when called by my EditorHelper inside a unit Test. I can manually include each of the required Helpers in my editor_helper_test file: ... require ''action_view/helpers/url_helper'' module EditorHelpe...
2006 Jan 16
2
ruby embedded code replacement for onclick in link?
Is there a ruby embedded code replacement for something like this? <a href="#" onclick="window.open(''http://192.168.78.12:3000/portfolio/show/<%= item.id %>'', ''test'', ''width=660, height=500,resizable=no'')"> <%= image_tag item.image_url, :size => ''200x150'' %></a> Thanks, Dan
2006 Jan 23
4
an image that is a clickable link?
Hi, How do I make an image that is a clickable link the rails way? Is there a view helper for this? Thanks, Peter
2011 Apr 19
1
RSpec/Webrat Checking output is properly escaped
...but rspec or webrat appears to be parsing the output into proper HTML chars instead of escaped characters. I have verified that it escapes properly in the regular browser json response. The relevant RSpec test code is: include ActionView::Helpers::TextHelper include ActionView::Helpers::UrlHelper it "should automatically sanitize any HTML or script characters" do post :create, :post_id => @post.id, :content => "<h1>Oh Hai!</h1><script>", :user_id => @user.id, :format => &...
2005 May 21
0
How can I get a post-Routing translated url_for?
...t; "info", :action => "welcome"} then the comparison involving @request.request_uri used in the current_page? method will not correctly deduce that "/" is in fact equal to {:controller => "info", :action => "welcome"} (see below for UrlHelper#current_page?). Thus, current_page? returns false when it should return true (in my case). So the trail that I''ve taken is this: @request.path_parameters is a hash containing the actual page that I''m visiting (after Routes are taken in to account). This is consistent, reg...
2008 Oct 12
0
How to test with RSpec a Rails plugin using “link_to” and “current_page?”
I''m writing a Rails plugin that builds up a menu in a view. I''m using *link`_`to* to build the link and *current_page?* to set class="active" on the current page. I''ve *include*d *ActionView::Helpers::UrlHelper* so I can use *link`_`to*. To get *current`_`page?* working in the view, I''ve had to inherit the current class (apparently ActionView::Base) and it works perfectly well. Unfortunately, this totally breaks the tests with RSpec. I''m calling *link`_`to* and *current`_`page?* like t...
2006 Jan 20
4
[newbie]how to use link_to to link to another controller?
I am just diving into Rails and I am a bit puzzled by the link_to function. am writing an app to display my photographs in categories. My application layout has a sidebar to show a menu with categories from the categories table in the database (like in taken from the tutorials), to be shown on every page. I managed to get a global @menu_categories object that keeps track of all the categories