Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # in model/tweet
- def add_a_tweet_on_timeline_to(username)
- add_a_tweet_on_the_file("#{RAILS_ROOT}/public/#{username}.js")
- end
- def add_a_tweet_on_the_file(file)
- File.open(file, 'r+') {|io|
- finale = "]);\n"
- io.seek(-finale.size, IO::SEEK_END)
- io.puts %|,{user: "#{@owner.username}", text: "#{@text}"}|
- io.write finale
- }
- end
Add Comment
Please, Sign In to add comment