Displaying 20 results from an estimated 50 matches for "my_action".
2007 Nov 16
3
Route Information
Is there a method to return a hash of the route configuration based on
a path?
For example:
magic_method(''/my_controller/my_action/my_id'')
=>
{:controller => ''my_controller'', :action => ''my_action'', :id =>
''my_id''}
Thanks!
Tom
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups...
2006 Jan 14
3
link_to_remote where the url contain a javascript variable
...y trying to use ''link_to_remote'' and pass the value
of a javascript variable as an argument. Something like that:
link_to_remote "my_link",
:update => ''my_div'',
:url => { :action => "my_action", :var =>
''my_var'' }
Basically, ''my_var'' is a javascript variable which I want to pass to
''my_action''.
This, of course generates:
<a href="#" onclick="new Ajax.Updater(''my_div'',
''/xyz...
2008 Feb 02
3
Question abt redirect_to..
...hat renders the fb:render
tag - In my form I''m setting the canvas to false, file is being
uploaded / save fine but when I attempt to redirect:
redirect_to :action => :new, :canvas => true
Unfortunatly it looks like my callback URL is getting printed twice, e.g.
http://myserver.com/my_action/my_action/new
I suppose I could write a helper to pull it out but there''s probably a
better way.. Any thoughts?
Thanks
2007 Feb 21
6
Problem with url_for and https - overrides all options
I have a piece of code like this in one of my views:
<%=link_to "link here", :action=>''my_action'', :id=>1 %>
It works fine on my local development machine, running Webrick over http
and it works fine on my testing server which is running single mongrel
instance behind Apache 1.3 as a proxy. On both the outcome link is this:
<a href="/my_controller/action/1">lin...
2005 Oct 16
13
More than one parameter with link_to_remote
...I''m
getting a behaviour that seems quite strange to me. Here''s the code:
link_to_remote ''some text'',
:update => ''form'',
:method => ''get'',
:url => { :action => ''my_action'', :id =>
@my_object, :extra_param => ''my_extra'' }
The URL I got is: ''/controller/my_action/32?extra_param=my_extra'' (32 is
@my_object''s id) but params[:extra_param] contains ''my_extra?''. Why that
extra question mark?...
2006 May 09
1
Reusing a model to form and link_to.
Hy guys,
Inside my app I have a form which contains user information.
Sometimes a have a form with a text_field as above:
<%= form_remote_tag(:html => { :action => url_for(:controller =>
"my_controller", :action => "my_action") }) %>
<%= text_field(''my_object'', ''my_parameter'', :maxlength => ''30'' )%>
<%= submit_tag "Send"%>
<%= end_form_tag %>
In the controller I retrive the information using:
@my_value = params[:my...
2006 Apr 03
1
Best way to set custom Controller options
Hi All!
I''m searching a good way to set some options in my Controllers; I tried
defining a custom function, ie:
class PeopleController < ApplicationController
set_my_actions :action1, :action2
end
class ApplicationController
def self.set_my_actions(*args)
@@my_actions = args
end
end
But ''@@my_actions'' sets the class variable to _every_ Controllers
classes!
Any hints?
Thanks,
Marco
--
Posted via http://www.ruby-forum.com/.
2007 Jan 12
5
Rails session parasite...
All,
I see this item on the merb-0.0.8 release notes
Added rails session parasite mode.
I am assuming merbs can piggy back off the rails current session.
How does one achieve that ?
Thanks
Fernand
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/merb-devel/attachments/20070112/0803f46e/attachment.html
2010 Jan 31
3
Append/Prepend to a template from controller method
...<head>
<%= yield :refresh_tag %>
</head>
<body>
<%= yield %>
</body>
</html>
So then if I want to add a redirect-after-delay, I add the following to
1) my controller and 2) the action''s view:
app/controllers/my_controller.rb
def my_action
redirect_after_delay ''http://www.google.com'', 3 if some_condition
end
app/views/my_controller/my_action.html.erb
<% content_for :refresh_tag do %>
<meta http-equiv=''refresh''
content=''<%=@redirect_delay%>;url=<%=@redirect_url%>&...
2007 Sep 20
11
Proposed API change for respond_to
Ez (or someone) asked on #merb tonight whether respond_to was the
right API for
what it does. After some discussion and pasties, I offer the
following proposed
API for content negotiation and response format selection:
First, what does respond_to do right now? I see at as performing 3
distinct
operations:
1. parse params[:format] and the accepts header to find out what
format the
2010 Jun 03
7
Scheduled tasks in Rails: Cron + wget = Best solution?
...question is: How would the cron job entry have to look
like in order to let cron "log in" (as admin for example) before calling
the action (for obvious security reasons)? This is what I have until
now:
20 * * * * /usr/bin/wget --quiet -O -
''http://www.mydomain.com/my_controller/my_action''
Thank you for opinion and/or hints!
Tom
--
Posted via http://www.ruby-forum.com/.
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0...
2006 Jan 23
2
Action Cache upgrade plugin
...et
''response.time_to_live'' to
the number of seconds before this cached item will be expired. If
not set, the default setting
of ''never'' will be used and the item will only be expired by using
the regular action cache
expiry mechanism.
def my_action
@response.time_to_live = 10.minutes
...
end
=== Performance
If a client requests an action whose output hasn''t changed since their
last request, the returning of
a 304 response instead of the full response greatly reduces the load on
the server.
---------...
2006 Jul 03
1
flash[:notice] followed by render
Hi,
Sometimes I see action code like
def my_action
flash[:notice] = "Flash notice"
render
end
It is even in DHH''s new World of Resources slide show page 22. With
this use of flash before render, the user will see the flash for the
next two visible displays. Am I missing something?
Thanks,
Peter
2006 Jun 27
2
Using a different layout/styleshheet
Hi,
I have a view that I use to display and capture data. Once the user
has input the required data, I then need to be able to print the view.
I know that I can setup a stylesheet to take care of the page layout
but it is not clear to me how I will make the print view call the new
layout.
If anyone could clarify this or point met in the right direction, I
would be most grateful.
Regards,
Paul
2006 Mar 04
4
How to redirect_to the same page after comment posting?
How can I have the page redirect_to the same page after someone posts a
comment?
I know that you can do "redirect_to :action => ''index''", but the page is
located at this URL:
/posts/2006/02/01/individual_post/
So, the action is "individual" which is in the "posts" controller, but
there is a custom URL mapped for the URL shown above. How can
2006 Mar 13
1
rendering templates outside defaultl views location
Hi,
I''d like to accomplish the following situation (pseudo code):
IF file /path/to/some/tpldit exists
render that
ELSE
render file from default tpl dir
END
Should I override some built-in Rails methods for this or is there an
easier (yet clean and DRY) way of doing this?
I''ve done something similar for the assetTagHelper related functions
using a tiny plugin that
2006 Feb 18
3
Edit in Place
I need help using In Place Editor by script.aculo.us
#controller
def my_action
#get the text to display initially
@fancy_text = "Some fancy *bold* and _emphasized_ text."
end
def update_text
#save your text here, and return the saved value
@fancy_text = params[:value]
render :layout => false, :inline => "<%= textilize( @fancy_text...
2006 Feb 26
1
Help with ruby=>html
Hi!
I''m new to ruby and rails and got problems with using basic methods like
form_tag or link_to etc to create what i need, i.e. to specify css class
or id or name of html elements.
I have problem with understanding rails api (it''s just as an example):
form_tag(url_for_options = {}, options = {}, *parameters_for_url)
what parameters can i pass to form_tag? How to specify
2006 Jan 27
1
Caching from screen scraping
Hi all,
I need to do some screen scraping from my rails app. Given an ethernet
(MAC) adress, I scrape results from an internal web page that returns
location and hostname. How can I cache the result from that screen
scraping as to be polite to the scrapee? I would like to expire the
results daily. In perl, I would use Cache::File. Can I use rails caching
for this? What''s the best
2006 Aug 06
0
Can I strip a file suffix off a URL with routing?
I would like a route that strips of the suffix of a url before
determining the action. Eg:
http://mydomain.com/my_controller/my_action.pdf
Would map to: { :controller => ''my_controller'', :action => ''my_action'' }
Is this possible?
Thanks,
-Jonathan.