You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/db/migrate/20190823024643_modify_cours...

43 lines
1.8 KiB

class ModifyCourseIntroductionForBoards < ActiveRecord::Migration[5.2]
def change
platform = PlatformSample.where(:samples_type => "courseGuide").first
content = '
线
线
- Python[Python](https://www.educoder.net/paths/13) | [Python](https://www.educoder.net/paths/11)
- Java[Java](https://www.educoder.net/paths/38)
- C/C++[C/C++](https://www.educoder.net/paths/3) | [C](https://www.educoder.net/paths/4)
- Matlab[MATLAB](https://www.educoder.net/shixuns/7bvs54gw/challenges) | [](https://www.educoder.net/shixuns/q4fowkfa/challenges) | [](https://www.educoder.net/shixuns/grunzcs3/challenges)
- HTML/CSS[HTML5+CSS3](https://www.educoder.net/paths/15)
- [Docker](https://www.educoder.net/paths/29)
... ...
'
platform.update_column(:contents, content)
messages = Message.where(subject: "新课导语")
messages.find_each do |m|
m.update_column(:is_md, true)
message_detail = m.message_detail
message_detail.update_column(:content, content) if message_detail
end
end
end