similar to: Howto add application-wide variables?

Displaying 20 results from an estimated 3000 matches similar to: "Howto add application-wide variables?"

2006 Jun 05
5
Controller-wide instance variable
Is it possible to declare an instance variable in a controller that is available to every action without defining the variable in every action? -- Posted via http://www.ruby-forum.com/.
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
2010 Jul 02
6
making something available application wide
I''d like to display a banner on every page. Ultimately I''ll be tweaking which banner is displayed via different controllers but initially I''d just like to set a single banner application wide and display it in my "_header", a partial I include in all layouts. I''ve got a BannerAdvert model, simple. If I''m in my welcome controller index action
2013 May 09
1
equivalent way to iterate through a hash
If I have something like this in my node file: daemontools_service::setup { ''carbon-cache'': service_name => ''carbon-cache'', .... extra_envs => { "GRAPHITE_STORAGE_DIR" => "/mnt/statsd-data/graphite-storage" "SOMETHING_ELSE" =>
2008 Jun 07
5
Can create record but can not update it => has_many through
Hi All, I have a problem using has_many through association. I can create a product without problem, but when i edit it, i got this NoMethodError: undefined method `reciters='' for #<Product:0xb71a77e8> Did i miss something to code? I provided the codes below. Please help Thanks, Dida product_controller.rb ====================== def create @product =
2013 Jun 13
0
[LLVMdev] RFC - Profile Guided Optimization in LLVM
On 2013-06-12 18:15 , Chandler Carruth wrote: > > On Wed, Jun 12, 2013 at 3:10 PM, Jakob Stoklund Olesen > <stoklund at 2pi.dk <mailto:stoklund at 2pi.dk>> wrote: > > It predates the block frequency interface. It just needs to be > hooked up, patches welcome. It would also be nice to remove the > floating point computations from the spill placement
2005 May 19
5
[OT] Sqlite2 question
So, under Sqlite2, if I want to update a database''s schema, I have to dump the DB, modify the table''s structure, then go and modify EVERY insert statement. The insert statements look like (from memory): INSERT INTO my_table VALUES (''some_id'', ''some_val'', '''', '''', '''', ''some_other
2013 Jun 12
3
[LLVMdev] RFC - Profile Guided Optimization in LLVM
On Wed, Jun 12, 2013 at 3:10 PM, Jakob Stoklund Olesen <stoklund at 2pi.dk>wrote: > It predates the block frequency interface. It just needs to be hooked up, > patches welcome. It would also be nice to remove the floating point > computations from the spill placement code. Cool, if Diego doesn't beat me to it, I may send you a patch as that seems easy and obviously
2006 Jun 04
5
filter function with parameter
Hi! I want to add a function with a static paramter ("2" in the example) to a filter, but somehow Rails seems to be looking for another syntax. before_filter :check_quantity(2), :only => [:show] doesn''t work. What''s the right way to do this? Thanks a lot! -- Posted via http://www.ruby-forum.com/.
2009 Mar 05
4
before_filter :action_name OR :action_name
Hi there I am wondering if we can use before_filter in the form of :action OR :action what i want to do is to implement one of the actions, if the first failed, then go to the second when i use before_filter :action1 before_filter :action2 each method will run them, my case is that i want to check if one of them is true and not both any idea?
2006 Jul 14
4
sending additional parameters to before_filter
i am trying to create a system so that different users have different priviliges on my application. i was going to modify my authorize function so that i could pass the required role to it and have it check the current user for that role. i am using before_filter and would like to have just one function instead of writing one for each role like so: authorize(role) instead of:
2006 Feb 27
3
Send parameter along with method in before_filter
Hello list, I have an app that has a very simple authorization scheme. A person can have many roles and roles can have many people. In my app, I''d like to do before_filter :login_required (since no role name is provided, it accepts any users with credentials) before_filter :login_required ("administrator") (only accepts those with role administrator) before_filter
2006 Jul 26
5
Restricting before_filter to certain actions?
Can you restric before_filter to specific actions? -- Posted via http://www.ruby-forum.com/.
2013 Apr 02
1
Untrusted domains with security=ads
Hello everyone, Samba 3.6.9 on CentOS 6.4. With "security = ads", winbind doesn't authenticate requests that prepend a not-existent domain to the username. Users that have logged into the domain authenticate transparently to squid with NTLM (format is domain\username), but not users that are logged in locally or into another domain with the same username and password (format is
2006 Apr 11
6
asp''s application object rails equivalent?
In asp there''s a built''in object, Application, which behaves like the session, but it allows you to share information among all users of the application. (http://www.microsoft.com/windows2000/en/server/IIs/default.asp?url=/windows2000/en/server/IIs/htm/asp/vbob6zkv.htm) It''s just like if every user would be accessing the same session. what is the rails equivalent?
2008 May 21
8
before_filter with multiple roles
I have multiple roles in my application. Now I want to block a method for all users except the administrator and a manager. When I do this: before_filter (:check_administrator_role), :only => [:administration] before_filter (:check_taskmanager_role), :only => [:administration] The user must have both roles. How can I change that to an "OR" combination? -- Posted via
2006 Jan 11
7
before_filter: how to give :except more than 1 value?
Hi all I have the following class: class MemberController < ApplicationController before_filter :authorize, :except => :index def index ... end Now I want to give the before_filter more than one :except argument. I tried :except => {:index, :login}, but this didn''t work. How can i accomplish this? Thanks a lot and have a nice day, Josh -- Posted via
2008 May 06
12
Why before_filter is not working?
I have been scratching my head on this one for most of the day. Hopefully someone can help explain why before_filter isn''t working for my codes. In my Application controller, I have this: before_filter :login_required, :except => [:newacct, :create_newacct, :passwd_reset ] def login_required unless session[:user_id] flash[:notice] = "Please log in"
2008 Jan 30
1
Can before_filter using Proc and specify block ?
Hi, I see from this post http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/97e333daab05b725/8252c90cb9c36f6d?lnk=gst&q=passing+parameter+before_filter#8252c90cb9c36f6d it can specify the Proc in the before_filter function, but when specify when action apply this filter, it raise an syntax error, such as rthe following code before_filter {|controller|
2006 Apr 21
9
Yet another dry question..
One of these days I''ll figure this out, but in the meantime help me be a better programmer by eliminating some excess code: I''m trying to check to see if somebody trying to view/edit/update a product is the owner. In my scaffold I have this code that works: def edit @owner = Product.find(params[:id].to_i) if @owner.user_id == @user.id @product =