Displaying 20 results from an estimated 6000 matches similar to: "Get current controller name/action name from view"
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
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
2005 Aug 08
1
url_for()/link_to() Broken under Webrick?
After successfully getting my "productized" sites into production, I decided it
was time to get the development environment working (i.e. through "script/server
--site=foo"). However, when I go to run a site under Webrick, I get two major
errors:
(0) Routes don''t seem to work properly, specifically the root-level route gets
ignored. Instead,
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
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
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
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 10
2
Make link_to_remote call redirect current view, not read redirected content
Hello everyone !
I have a link_to_remote which creates a Party from a ContactRequest.
The action on the server creates the party, marks the contact request
as processed, and then returns a redirect. According to my knowledge
of HTTP, that is the correct thing to do.
Unfortunately, Prototype is being too clever for me at this time...
It follows the redirect, without notifying me. Anybody has
2006 May 08
17
partial problem
def my_controller
@variable = [{''myfield''=>''grey''},{''myfield''=>''blue''}]
end
#-------------------------my_view
<table>
<%= render :partial=>''my_partial, :collection=>@variable %>
</table>
#----------------------_my_partial
<tr>
<td><%=
2006 Jan 02
3
best to integrate dynamic navbar into layout
I''ve been trying to come up with a good way to integrate a dynamic
navbar into my layout. By dynamic, I meas that each link has 3 images.
Normal, rollover, and dark for the current page. I have it working but
it seems like there should be a better way. Here is how I did it,
please let me know if there is a better way. Rails makes so many things
simple, that this seems very
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
2007 Jan 02
2
link_to method throws a url_for error
This error seems pretty bizarre. I''m using ActionMailer and am using
a template in app/views/welcome_mailer/join.rhtml which has this line:
<%= link_to :controller => ''group'', :action => ''join'', :group =>
@group.id, :ic => @code.code %>
The error is: undefined method `url_for'' for #<WelcomeMailer:
0x2aaaad4fb470>
2008 Dec 03
2
Rails functional test how to assert json result?
As title, I want to have my functional test check results from a json
render result, how can I achieve this?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this
2008 Aug 24
2
MWI working perfectly. Shouldn't it be broken??
I have a Sipura 962 endpoint on Asterisk 1.4 where the MWI works
perfectly, however my theory is that it should be broken.
Obviously I'm wrong but "Sip show subscriptions" does not show the
endpoint subscribing to the MWI status on Asterisk, even though all of
the other endpoints on the system DO subscribe for their respective
mailboxes, including SNOM & Polycom endpoints.
2006 Sep 05
1
Named routes and current_page? incompatibility
Hi,
I have some named routes defined e.g. map.public and wish to use
link_to_unless_current() to disable link.
However, as I''ve seen from forum discussions and the API doc, the issue
lies with the fact that the named_route_url() method generated by a
named route does not default to only_path = true like url_for.
Therefore, the current_page? within link_to_unless_current() will not
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
2007 Nov 15
1
''lazy'' url generation in view specs
Hi,
I would like to use the ''lazy'' style of url generation in my views,
omitting parameters from my calls to url_for (and named route
methods) that are then filled in from the current request parameters.
Example:
url_for(:action => ''index'') will fill in (:controller => ''posts'') if
params[:controller] is ''posts''
2009 May 28
1
[PATCH server] Change default flexchart view and increase vertical dimension of flexchart area.
---
src/app/views/graph/history_graphs.rhtml | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/app/views/graph/history_graphs.rhtml b/src/app/views/graph/history_graphs.rhtml
index 9488367..7a7e1e1 100644
--- a/src/app/views/graph/history_graphs.rhtml
+++ b/src/app/views/graph/history_graphs.rhtml
@@ -7,10 +7,10 @@ $('#flex_history_chart').flash(
{
2006 Nov 05
5
backgroundrb preview
Hi Ezra/skaar,
Wow man, the exercise was worth it. The connection closed problem with
socket as i mentioned in my earlier mails...completely disappeared,
and now i can connect only once to the socket and keep reading..till
end of its days.
Literally impossible with older release of backgroundrb.
This could also potentially solve the issues people were having with
ActiveRecord.
As i said
2007 Apr 09
8
How do I use link_to with all the current options?
In one of my pages I want to create some URLs that go to the same
page, but tack on an extra parameter (column sorting stuff). How do I
do that?
I''ve tried
link_to "Title", :sort => "title"
and that''s pretty close...it keeps the controller name, but it doesn''t
include one of the parameters. I''m using nested routes, so the URL
should