Ruby undefined method error -


i'm learning ruby on rails , working on redmine , redmine plugins currently.

<% row in rows %> <%row_array = rows.to_a%> <tr class="<%= cycle("odd", "even") %>">   <td class="name"><%= link_to h(row), aggregate_path(@project, field_name, row)  %></td>   <td>     <%       aggregate_link data, { field_name => row_array[0].id, "closed" => 0 },                      aggregate_path(@project, field_name, row,                                     :op => {"status_id"=>"o", "#{filter_by}"=>"><"},                                     "v[#{filter_by}]" => formated_dates(@dates),                                     "f" => ["status_id", "#{filter_by}", ""])     %> 

for reason code throws

"actionview::template::error (undefined method `id' []:array):"

rows activerelation of tracker class defined

class tracker < activerecord::base 

what understand here should access properties of row objects somehow, , print them on console still same error no matter do.

thing tried more or less : row.attributes[:id] , row.attributes["id"], row.id . of these prints correct variable throws error when want access them here field_name => row_array[0].id

ps : don't worry open tags, didn't paste of it, there no errors there far know.

thanks in advance!

edit : when debug row object has structure :

row(tracker class) -> @attributes(activerecord:attributeset) -> @attributes(lazyhashset) -> @values(hash) -> id.

edit 2 : puts row_array[0].methods prints these :

id

id=

id_before_type_cast

id_came_from_user?

id?

id_changed?

id_change

id_will_change!

id_was

reset_id!

restore_id!

so believe method calling correct.

edit 3 : row_array[0].attributes outputs :

{"id"=>1, "name"=>"hata", "is_in_chlog"=>true, "position"=>1, "is_in_roadmap"=>false, "fields_bits"=>0, "default_status_id"=>1}

alright problem wrong sql query returning wrong values, therefore of them didn't had .id method in them. corrected sql query , tried access id activerecord::relation["id"] solved problem.

thank tried help!


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -