Displaying 20 results from an estimated 8000 matches similar to: "save view to file"
2005 Nov 03
9
[Idea] session-wide persistent variables
I was thinking about having instance variable stored and fetched from
session container automatically before calling an action and after the
action is finished. Using methodology of accessors it would look like:
class MyController < ActionController::Base
persistent_attr :person
def alfa
person = ''John Smith''
# render as usual view alfa.rhtml with anchor
2007 Nov 30
5
render_to_string in an after filter
I''m using render_to_string in an after_filter, which renders a partial
that is sent to a web service. Here''s the code:
class MyController < ApplicationController
after_filter :post_to_webservice
def show
# show logic
end
def post_to_webservice
stuff = render_to_string :partial => ''stuff''
webservice_post(stuff)
end
I get a DoubleRenderError in the
2006 Feb 20
3
Rewriting with an after_filter
All -
I''m completely new to RoR and also new to programming in an MVC
structure...
The Pragmatic Programmers guide to Rails says, temptingly:
"After filters can be used to modify the outbound response, changing the
headers and content if required. Some applications use this technique to
perform global replacements in the content generated by the controller?s
templates (for
2006 Jan 16
3
routing to controller inside module
Hey,
am i to stupid to find the information about how to route to a
controller in a module? Maybe module support has gone!
The controller is under:
app/controllers/admin/my_controller.rb
The my_controller.rb file looks like this:
module Admin
class MyController
def index
render :text => ''Hello!''
end
end
end
How does a route to all controllers under module
2006 Mar 10
3
WML sites
Hi all
how to make a WML view for rails pages?
I''ve tried to create like:
<wml>
<card>
CONTENT
</card>
</wml>
but my phone says unsupported content type...
thanks
--
Posted via http://www.ruby-forum.com/.
2007 Dec 05
4
render :update and controller private methods
Probably asked and answered, but...
Why are controller private methods inaccessible inside the block
passed to render :update ?
This does not work:
class MyController < ApplicationController
def some_action
render :update do |page|
page.replace_html ''an_element'', some_private_method
end
end
private
def some_private_method
return
2006 Apr 25
1
Validations
Hi to ALL!
I am developing the small shopping cart application.
Inn the I created the models with out crud (not with scaffold)
I wrote my own htmls as for requirement.
How can i wrote the validations for my own rhtml files
Urbain
--
Posted via http://www.ruby-forum.com/.
2006 Feb 03
2
testing to see if emails are sent out on exceptions
Hi,
I''m using ActionController::rescue_action_in_public() to send emails
when uncaught exceptions happen.
Is it possible to write tests for that?
Joe
2008 Mar 17
2
Dynamic actions and views
Hi,
I have a set of messages stored in the db. These are email messages
that I have to send based on some condition. This is not the way I had
been doing all these days. I used to create an action in my controller
(class Notifier < ActionMailer::ARMailer) and then create an rhtml
file with the email content and then say
Notifier::deliver_my_email_message to send out the emails. But now
that I
2006 Mar 13
2
Newbie: Can''t get file to upload
Since I can''t get the fancy upload progress thing to work, I thought
that I would revert back to a regular file upload scenario.
I have a very simple file upload form set up. It appears that my file
parameter is coming into the controller as a string, not a file object.
Here''s my view:
<%= form_tag :action => ''save_HTML'',
:multipart
2006 Mar 31
4
form_remote_upload and rjs
I am using Kyle Maxwell''s form_remote_upload plugin with Rails 1.1, and
I cannot seem to get any code from my rjs template to execute.
The template works fine without the upload (if I remove '':html =>
{:multipart => true}'' from the form_remote_tag), but with the upload
nothing happens.
I have put ''<script>function
2007 Mar 26
2
Calling a controller action from script/console or runner
Is there a way to call or invoke a controller method from script/console
or script/runner? The reason is that I''d like to pre-cache some of the
actions on my controller.
The pseudo code below is what I''d like to be able to do:
class MyController < ApplicationController
caches_action :test
def test
puts ''Hi there''
end
end
script/console:
2006 Apr 14
2
Puzzled with filters
Hello everyone!
I''m trying to create an after filter for all my actions in all
controllers. I put it in application controller (application.rb).
class ApplicationController < ActionController::Base
after_filter :tidyit
def tidyit
xxxx # syntax error - intentionally
end
end
I have a Example (example_controller.rb) controller with index action.
class
2006 Apr 10
2
using web service for authenitcation
I am writting a web service for authenitcation of users and was using
web_service_scaffold :invoke for testing it out...and was able to consume it
using .NET. But my question is, whats the simplest method using which i can
use the same web service in the current Web App. I mean, not from an external
application or something but from the current web apps itself.
I found one method in AWDR, and
2006 Jan 30
5
a RJS problem/patch
Hi,
add_rjs_to_action_view.rb of javascript_generator_templates
doesn''t work with setting Content-Type in a controller.
(e.g.) http://wiki.rubyonrails.org/rails/pages/HowtoSetDefaultEncoding
class ApplicationController < ActionController::Base
before_filter :set_charset
def set_charset
@headers["Content-Type"] = "text/html; charset=utf-8"
end
end
I
2008 Sep 13
2
<meta http-equiv="refresh" content="5"/>
Do you know of any way for me to stick a meta tag in using a
before_filter or after_filter or around_filter?
<meta http-equiv="refresh" content="5"/>
I have been trying to figure out out and just cannot make sense of it.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2006 May 21
6
Is there a way to call helper methods in a controller?
Hi,
Is there a way to call helper methods in a controller?
I want to do something like this in my controller
Class MyController < Action....
def my_method
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
2006 May 25
5
Is there a way to abstract the updating of other parts of the page after an Ajax request without putting using the standard view file?
Hey all,
I''d like to abstract the process of updating different portions of the
page after an Ajax request has taken place. Rather than simply putting
the extra view logic in the standard rjs template, it seems to give
better separation if there is a split between the core view logic (ie,
inserting a row in a table), and updating any associated portions of
the page.
Is this possible? I
2006 Feb 21
4
customizing layouts for functions
I want to be able to have different layouts in my rails program for
different functions.
For example, when a person first comes to the site the layout will have
a link that says ''home'', ''login'', or register on the menu bar.
Once the user logs in however, the layout will change. I want it to show
the links ''account manager'',
2009 Jul 14
1
How to add after_filter-style render
Hello
I would like to execute specific action rendering something into page
after each of my ajax calls. In example I would like to update some
div or display an alert.
How I imagine it could work is as follows
class ApplicationController < ActionController::Base
after_filter :do_something_after_each_ajax_call
def do_something_after_each_ajax_call
if request.xml_http_request?