similar to: Using view helpers and route helpers in a model

Displaying 20 results from an estimated 2000 matches similar to: "Using view helpers and route helpers in a model"

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 include ActionView::Helpers::UrlHelper Also
2010 Dec 03
2
Rails 3 console ...
In the console to check my paths, I used to write ( In Rails 2) include ActionController::UrlWriter then I could test my paths : new_project_path , .... but now in Rails 3 include ActionController::UrlWriter gives an error NameError: uninitialized constant ActionController::UrlWriter sure something changed, any other additional include needed ? thanks fyh -- You received this message
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
2004 Dec 29
1
User authentication to AD200X, need local users?
I am trying to get user authentication in a 200X AD to have domain users see the samba shares (RH ES3, samba 3.0.9-1). I can see the shares, but when I try to access any of the shares, I get prompted for a username and password and this is what shows up in the log.winbindd file ------------------- [2004/12/29 08:17:37, 1] nsswitch/winbindd_user.c:winbindd_getpwnam(161) user 'robl' does
2007 Jul 06
1
Edge, link_to and mocks
Hi All, Anyone noticed that using the newer link_to syntax in edge currently fails with mocked objects in view specs or helpers. eg. if you have something like the following in your view (or equivalent in a helper): <%= link_to @dog.name, @dog %> as opposed to the current 1.2 syntax: <%= link_to @dog.name, dog_path(@dog) %> Using a mock_model as the ''dog''
2007 Dec 21
3
Access url_for from rake task
How do I access ActionController:Base url_for method from a Rake task. I tried to access ActionController from irb but it doesn''t work? Check out the pasite http://pastie.caboo.se/131266 -- Anil http://anilwadghule.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To
2006 Jan 10
4
Problem creating MockController
Hi there, I''m trying to create a mock controller to test the use of UrlHelper in ActionMailer. I''m trying this: require ''d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller'' # Re-raise errors caught by the controller. #class DiscussionsController; def rescue_action(e) raise e end; end class MockController < ActionController::Base def
2010 Sep 11
10
Having difficulty with threaded comments, using acts_as_tree
I''ve been having problems making threaded comments for the last few days. Mainly with creating children and displaying the children. Currently, I have comments shown at the bottom of my articles show view. The top level comments work, but I do not really know how to implement a way for users to "reply" to the top level comments and take them to a form (the comment
2008 May 11
3
Get current controller name/action name from view
Hi. I swear I found this in the group archives, but now I cannot find this in the group or elsewhere online! In a view I would like to get the current controller name and action that was used to get here. For example, I have a template that I''m using from two different controllers (and four different actions in each controller), such as :controller => "my_view", :action
2012 Aug 07
9
How do I force link_to/form helpers to use the superclass name in the path instead subclass?
I want my helpers to generate paths using a superclass instead of the subclasses. Assuming I have Owner and Member that both inherit from User, rails will use the current objects class name when generating paths: Let''s say current_user is a mod: <%= link_to current_user.name, current_user %> will generate "/mod/:id". I want to force it to generate
2006 Jul 31
0
problems testing helpers - link_to and url_for don''t work...
So I''ve used the helper test plugin, and also tried some things from Rails Recipes, and basically neither seems to work for cases where a helper does anything related to link_to/url_for, and this includes calling named_routes. This is obviously an issue, as a common use for helpers is to refactoring something like this: <%= link_to "text that changes slightly", :id => id
2005 May 21
0
How can I get a post-Routing translated url_for?
Is there a way to ask the Route system what controller and action mapping will be used, given a hash containing :controller and :action? I am trying to generalize the case where there is a button bar (e.g. tabbed pages) having one image shown if you are presently visiting that page, and another shown if you are not presently visiting that page (e.g. an "active" and an
2007 Feb 16
4
Auto detect URL for ActionMailer?
Hi, how can I call the url in an actionMailer definition - so that it automatically detects what the rails application server is and puts it in the url that is mailed to the client? (I don''t want to have to change it every time the hostname is changed - I''d like the application to auto detect what the host is - whether it''s localhost:3000 or my own website... example:
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
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 May 11
3
can''t call link_to from within a model class
can anyone tell me how to call link_to from within a model class? I''m trying to do something like the following: validates_uniqueness_of :email, :message => "address has already been taken. If you''ve forgotten your password, please click " + link_to(''here'', :action => ''forgot_password'', :controller =>
2007 Nov 14
3
absolute urls in url_for vs. link_to
In both url_for and link_to, the :only_path param can be used to determine whether the link url used is complete with hostname and path, or just has the path (a kind of relative url). However, in url_for it defaults to false (urls with hostnames), and in link_to it defaults to true ( urls without hostnames, just paths). Is there any reason for this discrepency? To me, it violates the principle
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
2010 Sep 09
17
formtastic issue
Hello, I will try to explain it step by step :-) I just created a new rails 3 app, then I created a new controller... rails generate controller admin::users I didn''t forget to add the resources in the routes.rb file like this. namespace :admin do resources :users end Now I try to use formtastic to create the form but I get erorr that my users_path doesn''t exist?
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