Displaying 3 results from an estimated 3 matches for "display_dates".
2006 May 22
13
How is this possible?
...m the console, the following code works, when run through
the WEBrick server I get a "You have a nil object where you didn''t
expect it!"
class Competition < ActiveRecord::Base
has_many :comp_dates, :order=>:position
def initial_date
comp_dates.first
end
def display_dates
i_d = initial_date
if i_d.nil?
return "unknown"
else
return i_d.month
end
end
i_d should never be nil, in the first place; but how on earth does the
i_d.month calls get reached when i_d is nil?
--
Posted via http://www.ruby-forum.com/.
2006 Jul 07
5
link_to: link is missing id
I''m using a legacy table, where the unique id is not ''id''
I have a Model class like the following:
class Article < ActiveRecord::Base
set_primary_key "ARTICLE_ID"
end
however, using a link_to like the following (modified scaffolding),
the link has no id value:
<% for article in @articles %>
<tr>
<% for column in
2006 Jul 16
1
Helpers for partials too ?
...ich will automatically have access
to the methods inside MainHelper (in \app\helpers\main_helper.rb).
Should not the partial templates called from main.rhtml via <%= render
:partial => ''partial'' %> also have access to the methods in main_helper
?
I have tried
<% display_dates = create_display_dates(@events) %>
and
<% display_dates = MainHelper::create_display_dates(@events) %>
and both report "undefined method `create_display_dates'' ..."
Do I misunderstand the nature of helper scoping ?
--
Posted via http://www.ruby-forum.com/.