Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Getting A String Instead Of An Array
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Frank  
View profile  
 More options May 4 2010, 2:22 pm
From: Frank <francisco.li...@gmail.com>
Date: Tue, 4 May 2010 11:22:29 -0700 (PDT)
Local: Tues, May 4 2010 2:22 pm
Subject: [webrat] Getting A String Instead Of An Array
Hi Guys,

I'm new to webrat and I've encountered a problem. I have a nested form
that I've created using the steps similar to the Rails Casts
http://railscasts.com/episodes/75-complex-forms-part-3

As context, I have a form for programming exercises with a title and
description. The form also has fields for the associated Hint object,
just a regular text area field for the hint text.

When I submit a form using webrat and cucumber my application receives
'params' with:

     "new_hint_attributes"=>"[{\"text\"=>\"This is hint 1\"}]"

The key 'new_hint_attributes' maps to a string causing the application
to crash during a cucumber test.

But when I submit the form using the browser my application receives
'params' with:

     "new_hint_attributes"=>[{"text"=>"This is hint 1"}]

The key 'new_hint_attributes' maps to an array and everything works
fine.

I was wondering what I might be doing wrong.

Also, I was wondering if this ticket my be related:
https://webrat.lighthouseapp.com/projects/10503/tickets/259-webratmec...

--
You received this message because you are subscribed to the Google Groups "webrat" group.
To post to this group, send email to webrat@googlegroups.com.
To unsubscribe from this group, send email to webrat+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/webrat?hl=en.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Damian Janowski  
View profile  
 More options May 6 2010, 9:29 pm
From: Damian Janowski <damian.janow...@gmail.com>
Date: Thu, 6 May 2010 22:29:52 -0300
Local: Thurs, May 6 2010 9:29 pm
Subject: Re: [webrat] Getting A String Instead Of An Array

Maybe you can create a gist with the relevant parts of your app and
tests so that we can reproduce it?

--
You received this message because you are subscribed to the Google Groups "webrat" group.
To post to this group, send email to webrat@googlegroups.com.
To unsubscribe from this group, send email to webrat+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/webrat?hl=en.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Frank  
View profile  
 More options May 7 2010, 2:22 am
From: Frank <francisco.li...@gmail.com>
Date: Thu, 6 May 2010 23:22:08 -0700 (PDT)
Local: Fri, May 7 2010 2:22 am
Subject: [webrat] Re: Getting A String Instead Of An Array
Right, excuse me.

Here are the relevant code snippets

http://gist.github.com/393116

Here is the entire html generated by the template

http://gist.github.com/393134

Notice that all the array params are strings instead of arrays in
'params' but all the hashed stay hashes.

On May 6, 7:29 pm, Damian Janowski <damian.janow...@gmail.com> wrote:

--
You received this message because you are subscribed to the Google Groups "webrat" group.
To post to this group, send email to webrat@googlegroups.com.
To unsubscribe from this group, send email to webrat+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/webrat?hl=en.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Frank  
View profile  
 More options May 10 2010, 5:45 pm
From: Frank <francisco.li...@gmail.com>
Date: Mon, 10 May 2010 14:45:52 -0700 (PDT)
Local: Mon, May 10 2010 5:45 pm
Subject: [webrat] Re: Getting A String Instead Of An Array
I've made some slight progress towards solving this. I switched from
Ruby 1.9.1 to ruby 1.8.7 and it solved the issue for several nested
file fields.
However, now I'm struggling with nested 'file_field'(s). I'm using
webrat 0.7.1, cucumber 0.7.2, rails 2.3.5 and ruby 1.8.7-p249

It is the same kind of error. I'm expecting an array of file fields in
'params'

 'key'=>["#<ActionController::TestUploadedFile:0x267bec8>"]

but instead I get one string that looks like:

 key=>"#<ActionController::TestUploadedFile:0x267bec8>"

I tried writing a few webrat specs to try and reproduce the problem
but I haven't had any luck. I was wondering if anyone is familiar with
what can cause "Expecting array but getting string" type errors.

I'm experiencing something similar to this closed ticket:
https://webrat.lighthouseapp.com/projects/10503/tickets/341-attach_fi...

And this past post:
http://groups.google.com/group/webrat/browse_thread/thread/a08a1cf4e8...

On May 7, 12:22 am, Frank <francisco.li...@gmail.com> wrote:

--
You received this message because you are subscribed to the Google Groups "webrat" group.
To post to this group, send email to webrat@googlegroups.com.
To unsubscribe from this group, send email to webrat+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/webrat?hl=en.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Frank  
View profile  
 More options May 11 2010, 6:07 pm
From: Frank <francisco.li...@gmail.com>
Date: Tue, 11 May 2010 15:07:58 -0700 (PDT)
Local: Tues, May 11 2010 6:07 pm
Subject: [webrat] Re: Getting A String Instead Of An Array
Hi Guys,

I've been trying to figure this out for a few days now. To better
describe what I'm experiencing
I've created a very simple github rails project at http://github.com/flsafe/test

Check out the README on the github project page.

This project has just two models. A user and and Image. A user has
many images.

To see what I'm talking about one would clone the project with:

   git clone g...@github.com:flsafe/test.git

Then run:

   rake cucumber

The output will contain a description of the values I'm expecting in
the
'params' variable in the controller.

I know it's a lot to ask to checkout the project. I'm sure everyone is
very busy.
But I would really appreciate it after trying to figure this out for a
few days.

Thanks

On May 10, 3:45 pm, Frank <francisco.li...@gmail.com> wrote:

--
You received this message because you are subscribed to the Google Groups "webrat" group.
To post to this group, send email to webrat@googlegroups.com.
To unsubscribe from this group, send email to webrat+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/webrat?hl=en.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matt Wynne  
View profile  
 More options May 12 2010, 4:28 am
From: Matt Wynne <m...@mattwynne.net>
Date: Wed, 12 May 2010 09:28:14 +0100
Local: Wed, May 12 2010 4:28 am
Subject: Re: [webrat] Re: Getting A String Instead Of An Array

On 11 May 2010, at 23:07, Frank wrote:

Just quickly Frank, you might have more luck with Capybara. It's basically a re-write of Webrat with a very similar API, but there seems to be a more active community around it.

I would try using capybara and see if your problem goes away. Then I'd try asking the capybara mailing list for help. There are a lot more people active in there.

--
You received this message because you are subscribed to the Google Groups "webrat" group.
To post to this group, send email to webrat@googlegroups.com.
To unsubscribe from this group, send email to webrat+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/webrat?hl=en.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Damian Janowski  
View profile  
 More options May 14 2010, 12:26 pm
From: Damian Janowski <djanow...@dimaion.com>
Date: Fri, 14 May 2010 13:26:52 -0300
Local: Fri, May 14 2010 12:26 pm
Subject: Re: [webrat] Re: Getting A String Instead Of An Array

On Tue, May 11, 2010 at 7:07 PM, Frank <francisco.li...@gmail.com> wrote:
> Hi Guys,

> I've been trying to figure this out for a few days now. To better
> describe what I'm experiencing
> I've created a very simple github rails project at http://github.com/flsafe/test

Hello Frank,

Thanks for providing a repo for the test.

After a couple of hours debugging this isssue, I added a branch that
shows that the behavior you're trying to use actually works. However,
in your sample app, you're using what I think is a strange flavor of
fields_for. Although I haven't done any Rails in a while, the docs
show that the usage should be like this:
http://github.com/brynary/webrat/blob/rails_attach_file/spec/integrat...

Can you please check if there's anything missing in the branch I
created? http://github.com/brynary/webrat/blob/rails_attach_file
Note that under ./spec/integration/rails there's a fully fledged Rails
app that tests Webrat's integration with Rails.

If you see anything missing that would cause the integration test to
break, please provide a patch for the branch and we'll look into it.

Thank you.

--
You received this message because you are subscribed to the Google Groups "webrat" group.
To post to this group, send email to webrat@googlegroups.com.
To unsubscribe from this group, send email to webrat+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/webrat?hl=en.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »