On 11 Jul 2011, at 17:51, John Merlino <[email protected]> wrote:
> Hey all,
>
> This here is not working:
>
> task(:load_selected => :load_config) do
> IgnoreTables = %w('students')
I think you'll find that this array is ["'students'"] but you expected it to be
["students"]
Fred
> begin
> ActiveRecord::Base.establish_connection
> ActiveRecord::Base.connection.tables.each do |table|
> if IgnoreTables.include? table
> puts "Its true"
> next
> else
> ActiveRecord::Base.connection.execute("TRUNCATE #{table}")
> end
>
> end
> end
> end
>
> Despite that some point table will be equal to students and students
> is in the IgnoreTables array, it should skip to the next iteration,
> but rather the else is triggered and the table is truncated.
>
> Anyway know how to address this? Is there a method part of connection
> that will help me achieve what I am trying to do?
>
> Thanks for response
>
> --
> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.