Ruby on Rails Saturday, April 30, 2011

Colin Law wrote in post #995978:
> On 30 April 2011 18:00, David Mr. <lists@ruby-forum.com> wrote:
>>>
>>> So gamma[:C] is not a collection. Have a look at the Rails Guide on
>>
>>
>> attr_accessor :setA, :setB, :setAList, :setBList, :google
>
> First I would stick to the Rails conventions when naming things, so
> these should be set_a and so on.
>
>> before_create :setup_data
>> before_save :setup_data
>> def setup_data
>> debugger
>> setax = []
>> setbx = []
>
> You don't need the above as split will return an array
>
>> setax = setA.split(" ")
>> setbx = setB.split(" ")
>
> Are you saying that this method gets called ok but at this point,
> checked in the debugger, that setA has a sensible value but setax does
> not?
>
> It might help also if you explained whether any of the variables are
> db columns and which are just instance variables.
>
> Colin

As a quick reply...

Yes setA has a sensible -as expected value, but setax is always nil. I
can go to the debugger window and do setax = setA.split(" ") and then
setax has the proper value. How is that happening?

No, the variables are not the column names. The setA and setB data are
put into a table named 'searches' and column named 'terms'. The setA
and setB data are entered from a form using form_for.

Thanks

--
Posted via http://www.ruby-forum.com/.

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

No comments:

Post a Comment