similar to: call a method once per page request

Displaying 20 results from an estimated 10000 matches similar to: "call a method once per page request"

2005 Dec 30
6
call a method once per page request
Hi, I''m wondering if there is a simple solution to call a method once per page request. I tried to place my call in a before_filter in ApplicationController but it''d called a second time if I use render_component from a view. Seems to me that a hook should be added in Dispatcher#prepare_application. Context: working on i18n, I''m trying to check lang either from uri,
2009 May 27
0
One url with multiple controllers
Lets say that I want to have one url that can map to two different controllers. For example /posts could map to controller ''public/ posts'' or to the controller ''admin/posts'' based on whether or not the user has logged in. This isn''t a great example because I could just use ''/admin/posts'', but in my scenario the url has to be the
2012 Feb 18
0
Rails NameError : uninitialized constant RelationshipsController
I am trying to run a test of my app buy my relationships_controller_spec.rb file won''t run. Here''s the error I get: Exception encountered: #<NameError: uninitialized constant RelationshipsController> Here''s the code for my relationships_controller_spec.rb file: require ''spec_helper'' describe RelationshipsController do describe "access
2006 Jun 02
0
Trying to use Ajax scaffold throws up odd behaviour
|Interesting... On a new project with a fresh database just created, I downloaded the smooth-loking Ajax Scaffold generator and tried it out on a ''pages'' table: C:\radrails\project>ruby script\generate ajax_scaffold Page PageAdmin (I''m using Windows.) After it calmed down I tried to access my shiny new admin page, but I got this:| ----- NameError in
2006 Feb 05
4
Another layout question - Layouts on a per method basis - Layouts with AJAX
I feel I am very close to understanding how layouts are used in Rails: Q1. I know one can specify a "default" layout for all methods in a controller by specifying layout ''my-default-layout'' How can this be overridden for individual methods so when those methods are called/executed, the overridden layout will be used. Is this possible? Q2. With no
2012 Feb 11
1
rake command shows the error
rails -v=2.3.8 gem -v= 1.4.2 ruby -v=1.8.7 When i issue the "rake" command ,it gives the following error . (in /home/amrit/amrit/OSV/OpenStreetView) /usr/bin/ruby1.8 -I"lib:test" "/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/functional/main_controller_test.rb" "test/functional/upload_controller_test.rb"
2010 Nov 05
0
RoR:OSV: Installation issue
I am trying to get a local installation of OpenStreetView, on Ubuntu 10.10 On installing Rails (2.3.8) and OSV code using git, when I issue "rake" command, I get response, which is reproduced below signature. What is missing from my installation? -- .O.C. $ rake (in /home/meet/OSV/OpenStreetView) /usr/bin/ruby1.8 -I"lib:test" "/var/lib/gems/1.8/gems/rake-0.8.7/lib/
2006 Feb 09
4
Login_Engine: trouble configuring
Hi Guys, I''m having some trouble getting login_engine to work. I''ve followed the steps in the README file to the letter (I think) with the exception of the Mailer stuff and cannot get my application to run. Heres what I have; module ApplicationHelper include login_engine end ##################################### require ''login_engine'' class
2006 Jun 07
6
Links on the left hand side - are components necessary?
Hello, Maybe this is super-trivial... I need to have a list of links on the left hand side of my application, for *every* single page. So, I''ve created a layout called "main" (main.rhtml) under view/layouts, and included >layout "main"< in pretty all of my controllers. main.rhtml has, amongst all the other HTML stuff: <%= render_component
2006 Jan 05
0
Subdomains - redirect to different actions?
Hey, I''m trying to figure out what the most elegant way to do this - I''ve only got a small amount of different subdomains corresponding to categories - and I''ve been using fragment caching. In particular, I was wondering what the best way to call these actions is - I''m thinking redirect and render_component aren''t really very nice
2006 Feb 19
2
instance variables in components not read by component view?
Hi, I''m trying to write a sidebar menu with dynamic menus, and to do so I would like to define a list of menus to display within my sidebar component controller code and pass that list to the component display view, like so: # menu_controller.rb class Sidebar::MenuController < ActionController::Base uses_component_template_root @menus = %w{admin user help} def display
2008 Jun 17
3
Help with error - uninitialized constant AuthenticatedSystem::Base64
I am using restful_Authentication plugin combined with the built-in http_basic authentication Rails 2.0.2 The following code in my controller seemed to work fine, 1. before_filter :authenticate 2. 3. def authenticate 4. case request.format 5. when Mime::XML, Mime::ATOM 6. if user = authenticate_with_http_basic { |name, pass| User.authenticate(name,
2006 Jan 24
1
render_component and private access...
I was wondering if rails had any means of restricting access to an action in a controller (like they can''t type in url.com/cont/action, that would throw an error). The thing is I would like to be able to access this method/action through a call to render_component, so therefore, I don''t think private methods will work. So basically I am looking for something that cannot be
2006 Feb 08
1
render_component vs. render_component_as_string?
I''m calling render_component in a helper. render_component :controller => target_controller, :action => "show", :id => target_id This works fine, except that passing the id in :params didn''t work and I had to pass in an explicit :id parameter to get the target controller to override the id - is that documented anywhere? That''s not my question. My
2011 Feb 28
1
Problem with render_component and rails 3
I have a application that it use view/layout/application.rhtml, in this file I have: <%= render_component :controller => ''car'', :action =>''index''%> But there is one problem, it display this problem: undefined method `render_component'' for #<#<Class:0xb67e6e48>:0xb67e5f34> How can I resolve this problem? -- You received this
2006 Apr 07
1
Help... Ajax scaffold problems
Hi all, Any help is appreciated. I used the ajax scaffold generator to make 3 scaffoldings. Then I put them together as components in a combined layout and created a master controller, which happens to be named "dataentry''. That works fine. Within each of the components, I was able to set up links that paginate and update the div (for the component) with correctly paginated
2006 May 26
1
flash.keep not working with render_component
Using Rails 1.1.2 and ruby 1.8.4 I''m having a weird issue with the flash when using render_component for an action inside different controller than the one from which you render. I''m passing an object via flash across a couple of actions (new and create) behind the scenes using flash.keep(:object). It works fine if the component I''m rendering is in the same
2006 May 07
0
caches_action and render_component
I''ve made some test: ------------------ CODE ------------------ class FooController < ActionController::Base caches_action :foo def foo render_text ''Hello, foo<br />'' end end class BarController < ActionController::Base def bar render :inline => <<-EOS Hello, bar <br /> <%= render_component(:controller =>
2006 Mar 14
0
how to render_component in global layout
Hello, i have one layout file for all controllers. I would like to have news list on each page. So, i put <%= render_component :controller => "news", :action => "list" %> , to my layout file. But this doesn''t work at all. I get error "Application could not be started.. ". If I put render_component to some view file say
2011 Dec 12
0
<%= render_component %> Tag cloud issue for rails version 2.3.11
hi all, in my application there is tag''s cloud in old code which is load using following code <%= render_component :controller => "controller_name", :action => "tag_cloud_homepage"%> now i upgrade the ruby,gem and rails version to Ruby :1.8.7 Rails :2.3.11 gem :1.6.2 and i am using Windows XP as O.S my question, now in Rails 2.3.11 "<%=