Hi,
Anyone can help me, I run my source code using rake task. It seems no
error was trace, but when I look the table it doesn''t insert.I select
the data here MysqlDB.Tablename and update/insert here
SQLserverDB.TableName.
# Start Here
# rake mysqldata_select:sqldata_update
def clean_html(html)
new_html = strip_tags(html) # remove html tags
new_html = decode_entities(new_html) # remove html encoded items
new_html = new_html.strip # remove any whitespace from the edge of
content
end
namespace :mysqldata_select do
LOCATIONS = {1 => 6, 2 => 5, 3 => 5}
task :sqldata_update => :environment do
include ActionView::Helpers::SanitizeHelper
MysqlData::TableName.all(:conditions => {:field_id => [1,2,3]},
:order => :field_primary).each{ |j|
r = TableName.new
# place
r.field = j.field_primary
r.location_id = LOCATIONS[j.field_id]
# save the item to get an ID
r.save
# find any translations
attributes = {}
%w{tc sc jp kr pt}.each{ |language|
attributes[language] = {}
field = j.field_primary(language, true)
attributes[language][''field''] = field unless
field.nil?
}
# insert the translations
r.update_attributes(attributes)
puts r.field
# break
}
end
end
# End Here
Thanks in Advance
--
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---