Forum: Ruby on Rails undefined method join for STRING error

Posted by John Merlino (johnmerlino)
on 2010-03-09 21:55

Hey all,

I was converting  a haml file to erb and when finished, I ran the app
and got this error message:

NoMethodError in Students#student_fail

Showing app/views/students/student_fail.erb where line #40 raised:

undefined method `join' for #<String:0x105a5e0c8>

Extracted source (around line #40):

37:
38:          <%  fields << render(:partial =>
"resources_partials/sequence/nav", :locals =>
sequence_info.merge({:cancel_url => {:controller => :dashboard}})) %>
39:
40:         <%= render_form { fields } %>
41: <% end %>

Thanks for any response.
Posted by John Merlino (johnmerlino)
on 2010-03-09 23:13
John Merlino wrote:
> 
> 
> Hey all,
> 
> I was converting  a haml file to erb and when finished, I ran the app
> and got this error message:
> 
> NoMethodError in Students#student_fail
> 
> Showing app/views/students/student_fail.erb where line #40 raised:
> 
> undefined method `join' for #<String:0x105a5e0c8>
> 
> Extracted source (around line #40):
> 
> 37:
> 38:          <%  fields << render(:partial =>
> "resources_partials/sequence/nav", :locals =>
> sequence_info.merge({:cancel_url => {:controller => :dashboard}})) %>
> 39:
> 40:         <%= render_form { fields } %>
> 41: <% end %>
> 
> Thanks for any response.



Render form is defined in resources_form_helper.rb:

  def render_form
    %Q{<ul class="form">\n#{ yield.join "\n\t" }\n</ul>\n}
  end
Posted by Colin Law (Guest)
on 2010-03-10 09:00
(Received via mailing list)
On 9 March 2010 22:13, John Merlino <lists@ruby-forum.com> wrote:
>> Showing app/views/students/student_fail.erb where line #40 raised:
>> 40:         <%= render_form { fields } %>
>> 41: <% end %>
>>
>> Thanks for any response.
>
>
>
> Render form is defined in resources_form_helper.rb:
>
>  def render_form
>    %Q{<ul class="form">\n#{ yield.join "\n\t" }\n</ul>\n}

Doesn't join require an array rather than a string?

Colin
Posted by Colin Law (Guest)
on 2010-03-10 09:02
(Received via mailing list)
On 10 March 2010 07:58, Colin Law <clanlaw@googlemail.com> wrote:
>>>
>>> 39:
>>    %Q{<ul class="form">\n#{ yield.join "\n\t" }\n</ul>\n}
>
> Doesn't join require an array rather than a string?

I meant it is a method of Array not String of course.

Colin
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.