similar to: Checking for nil in views

Displaying 20 results from an estimated 40000 matches similar to: "Checking for nil in views"

2006 Jan 14
4
hide_action doesnot hide view
The view file (eg. apps/views/items/list.rhrml) is still displayed even when the action is hidden (hide_action :list). How can I hide view file form being automatically displayed in this circumstance? thanks, jigar -- Posted via http://www.ruby-forum.com/.
2006 Feb 07
17
Easy way of dealing with nil properties in templates?
Is there an easy way to deal with nil properties in templates? All I''m aware of are these methods, and it''s quite tedious and surely violates DRY. <%= @member.name unless @member.name.nil? %> <%= @member.name.to_is %> <%= "#{@member.name}" %> csn __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the
2006 Apr 25
2
Bug in Rails 1.1 implementation of before_filters
I just spent a few hours tracking down a bug in Rails 1.1, so I thought I''d post the issue and a workaround just in case anyone else hits it. I designed a security enhancement so that controller methods can be protected by preceding them with a role. The standard Ruby method_added() callback is used to detect when controller methods are added, and then I manipulate the
2006 Jul 15
3
Why app/helpers are not app/view/helpers ?
So that we can write controller code inside helpers ? are we supposed to do that ? -Pratik -- rm -rf / 2>/dev/null - http://null.in "Things do not happen. Things are made to happen." - JFK
2007 Jun 27
5
Filter Ordering in Edge Rails (Rev 7143)
Filter chaining appears to behave in differently than Rails 1.2.x. It seems that I''m getting a lot of errors along the lines of: ActionController::ActionControllerError: filter #<ActionController::Filters::ClassMethods::BeforeFilterProxy:0x322f468 @filter=#<ActionController::Filters::ClassMethods::SymbolFilter: 0x322f4b8 @filter=:login_required>> was in the wrong place!
2006 Jun 24
3
Performance vs normalization best practice
I have a common situation and would like best practice suggestions from some of you more experienced rails developers. In my DB I''ve normalized tables in a traditional manner, e.g. I have Posts which have authors stored in a Users table. My problem is when I go to show a list of Posts and I want to display the author name (e.g. post.author.name) ActiveRecord appears to do a SELECT
2006 Jan 13
4
Flash not cleared with ActiveRecord session store
Cheers, I''ve stumbled over a bug with 1.0 and ActiveRecord store for session while migrating from pstore sessions. I created the table with `rake create_sessions_table` and set `config.action_controller.session_store = :active_record_store` in environment.rb. Everything runs fine except that the flash messages will not be cleared. I get the same message everytime on everypage I
2006 Jan 04
7
<% if ... -%> What is this?
I seen some RoR code that went like this: <% if ...blah, blah... -%> .. blah, blah <% end -%> What are the minus signs for in the if statement? Cannot seem to find anything about this, and searching on "-" in this context is hard to get anything meaningfull back. Thanks, - Mark -- Posted via http://www.ruby-forum.com/.
2006 Jan 14
3
How to render from a different controller
My code is something like this. class FirstController < ApplicationController def foo #some processing render (:controller => ''second'', :action => ''index'') end end I tried using both render and redirect but it seems it''s not possible to send the control from within a controller to some other controller. Am I missing something
2006 Jul 13
3
Performance diff between rendering partial vs. calling a helper?
Hi, Is there any performance difference between rendering partials vs. calling a helper? When we initally started coding we built a bunch of small partials and if there is a significant performance overhead with them, we''ll probably try to switch them over to helpers. They seem like they would be quite similar but I don''t know the full details of how partials are handled.
2006 Feb 05
30
Emacs rails.el
Features: * Management WEBrick - start, stop * Viewing log files * Abbrev from TextMate * Switching between View/Action http://www.emacswiki.org/cgi-bin/emacs/rails.el
2003 Jul 06
3
Digital phones
Hello. Second question. Should I be asking this on the dev list (that's not the question by the way). Q. - there are several mentions on the list that asterisk :- "can interoperate with almost all standards-based telephony equipment" "interconnection with digital and analog telephony equipment" "visual message waiting indicator" etc. etc, That seems
2006 Jul 16
2
how to specify a hash in a migration create_table.
I want to have a column in my model that needs to store variable information in a structured manner. For example,: Equipment type computer: ram: 512-mb os: PuppyLinux 2.0.1 Equipment type router: manufacturer: LinkSys ports: 4 wireless: yes I would have customized view ( RJS ) that would prompt the user for the correct information based on the EquipmentType selected. The info
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,
2006 Jan 23
6
Code coverage tools in Ruby?
Can anyone help me find a code coverage tool in ruby? What I want is: given a set of tests that I run, what lines of my code and what routines are covered. And also a list of uncovered routines and tests. I couldn''t find an open source one out there... -- www.kenlet.com
2006 Jan 04
7
variables in layouts
I have a layout that provides the basic outline of each page in my app. It has a title, footer and a navigation bar. In the title I want to put the name of the current user that is logged in. I could do something like @session[:username] but I would rather encapsulate that into a single variable so that I can change the key in the session map if I want without having to goto each page that
2006 Mar 08
5
ActiveRecord returning Strings with find_by_sql?
Hello, I''m new to Ruby & Rails, and I''m trying to figure out if this behavior by ActiveRecord is by design, or if I''m doing something incorrectly. Here''s the deal: I have a class based on ActiveRecord::Base that defines a method that creates a query using find_by_sql(). The fields retrieved by joins with other tables are being returned as Strings,
2006 Jul 19
3
Component Question
It appears that in Rails''s initializer.rb, the $LOAD_PATH is initialized with the paths for all the components included in the app before the models. This has the effect that if there is Foo class in your models directory and a Foo class in a component you''ve included, the Rails loader loads the component and not the model from your models directory. While you could
2006 Jan 21
3
Fragment caching with Memcached slow?
Hi, I am trying to do fragment caching using :mem_cache_store. However, when I compare it to fragment caching using :file_store, it seems to be a lot slower. Here are the results: uncache Completed in 2.20246 (0 reqs/sec) | Rendering: 2.19891 (99%) | DB: 0.00017(0%) | 200 OK [ http://127.0.0.1/] using file_store Completed in 0.00952 (105 reqs/sec) | Rendering: 0.00702 (73%) | DB: 0.00000(0%)
2006 Jan 23
8
yield vs @content_for_layout, etc..
I am relatively new to RoR and Ruby for that matter. A few questions for the pros: Question 1: In the 5min ajax video the presenter uses <%= yield %> in his layout. In the agile book, @content_for_layout is used. Since, yield is an actual Ruby construct, is it more efficient and preferred? What is the difference? Question 2: Links are often of the form :action =>