I could not find anything out about it (googling) and it’s not the
clearest error message. Not sure if it’s related to an expected data
type but that wouldn’t make sense. The only other thing I can think
of is the view only has place holders for 6 of the 12 columns. Think
it’s 12 :).
<%= (position.title) %>
<%= (position.category.name) %>
<%= (position.comapny_id) %>
<%= (position.city) %>
<%= (position.state.name) %>
<%= (position.entered_on_date) %>
Here is the method in the controller:
def positionslist @positions = (Position.find_all)
end
The model:
class Position < ActiveRecord::Base
belongs_to :category
belongs_to :contactmethod
belongs_to :edureq
belongs_to :expreq
belongs_to :postlength
belongs_to :securityclear
belongs_to :state
Hey Stuart, with the error dump you supplied it’s hard to tell what’s
up, but your code looks a little suspicious:
the view references position, not @positions (I gather is a
partial :collection => @positions ?)
but the Class method find_all is most “disturbing”.
Position.find_all is already defined by AR - even if you’re
overriding, it’s defined incorrectly (I think),
should be:
def self.find_all
Position.find(:all)
end
I’d just kill it entirely, unless you’re intending on juicing it up
with more code.
Those are just a couple of thoughts Stuart that I hope help. If you
can provide a stack trace from the development.log we’ll have a
better chance helping out.
Hey Stuart, with the error dump you supplied it’s hard to tell what’s
up, but your code looks a little suspicious:
the view references position, not @positions (I gather is a
partial :collection => @positions ?)
I’m still investigating this but it wasn’t intended or set up as a
partial.
I’d just kill it entirely, unless you’re intending on juicing it up
with more code.
Those are just a couple of thoughts Stuart that I hope help. If you
can provide a stack trace from the development.log we’ll have a
better chance helping out.
By including these things you won’t have to worry in your view if
something
is nil or not. Alternatively you could put unless (object to go between
<%=
%>).nil? eg
I appreciate the confidence but sadly enough it’s not in there , and
that is an important part of getting rows returned. My apologies. I’m
not at the machine right now but this will be the first place to
start.
If that @postions.each do |position| is not in your view, or you don’t
have
a line that looks like ,
<%= render :partial => ‘position’, :collection => @positions %> Then
there
is not a usual way for looping through the list of positions in your
views.
Unless you have some kind of loop construct that sets up the local
positionor you have specifically set it up, it will not be set in your
view. Since
you’re not getting a nil error I don’t think this is an error. It must
be
looping somewhere.
<% end %>
I have made modifications I believe may help you.
Are you showing examples for the string interpolation or you think
those particular fields would require it ?
Yes, I’m showing the fields that I think will require interpolation.
If
it’s not a string, you need to make it one. (at least that’s my
understanding of erb)
Sorri for my short post before… I’m at work and, well you know…
No apologies necessary, totally appreciate any help I get.
In here assuming that in the view you have something like
<% @positions.each do |position| %>
I appreciate the confidence but sadly enough it’s not in there , and
that is an important part of getting rows returned. My apologies. I’m
not at the machine right now but this will be the first place to
start.
<% end %>
I have made modifications I believe may help you.
Are you showing examples for the string interpolation or you think
those particular fields would require it ?
belongs_to :expreq
validates_associated :category
By including these things you won’t have to worry in your view if something
is nil or not. Alternatively you could put unless (object to go between <%=
%>).nil? eg