I''d like to convert some simple, general ruby scripts I have into rails
apps just for testing purposes. Many of these apps are not DB driven, so
the whole CRUD concept does not apply to them... here''s a sample:
require ''socket''
server = TCPServer.new(''12345'')
while (session = server.accept)
Thread.new(session) do |this_session|
data = this_session.gets
public_ip = this_session.peeraddr[3]
this_session.close
puts Time.now.strftime(''%Y-%m-%d'')
puts Time.now.strftime(''%H:%M:%S'')
puts public_ip
puts data.strip
puts data.strip.length
end
end
How easy would it be to make this into a rails app?
Many thanks!
Brad
--
Posted via http://www.ruby-forum.com/.
Can we assume you want to handle this via HTTP? If so, then it''s trivial, once you know and understand Rails. Rails controllers and views have absolutely no inherent dependencies on database backends. -- -- Tom Mornini On Jun 27, 2006, at 4:05 PM, Brad wrote:> I''d like to convert some simple, general ruby scripts I have into > rails > apps just for testing purposes. Many of these apps are not DB > driven, so > the whole CRUD concept does not apply to them... here''s a sample: > > require ''socket'' > > > > server = TCPServer.new(''12345'') > > while (session = server.accept) > > > > Thread.new(session) do |this_session| > > > > data = this_session.gets > > public_ip = this_session.peeraddr[3] > > this_session.close > > > > puts Time.now.strftime(''%Y-%m-%d'') > > puts Time.now.strftime(''%H:%M:%S'') > > puts public_ip > > puts data.strip > > puts data.strip.length > > > > end > > end > > How easy would it be to make this into a rails app? > > Many thanks! > Brad > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
On 6/28/06, Tom Mornini <tmornini@infomania.com> wrote:> > Can we assume you want to handle this via > HTTP? > > If so, then it''s trivial, once you know and > understand Rails. > > Rails controllers and views have absolutely > no inherent dependencies on database backends.I have used non AR classes in rails without any problem. I wasn''t using Threads though. From what I''ve read I think there may be some issues using threads within the rails environment. --> -- Tom Mornini > > On Jun 27, 2006, at 4:05 PM, Brad wrote: > > > I''d like to convert some simple, general ruby scripts I have into > > rails > > apps just for testing purposes. Many of these apps are not DB > > driven, so > > the whole CRUD concept does not apply to them... here''s a sample: > > > > require ''socket'' > > > > > > > > server = TCPServer.new(''12345'') > > > > while (session = server.accept) > > > > > > > > Thread.new(session) do |this_session| > > > > > > > > data = this_session.gets > > > > public_ip = this_session.peeraddr[3] > > > > this_session.close > > > > > > > > puts Time.now.strftime(''%Y-%m-%d'') > > > > puts Time.now.strftime(''%H:%M:%S'') > > > > puts public_ip > > > > puts data.strip > > > > puts data.strip.length > > > > > > > > end > > > > end > > > > How easy would it be to make this into a rails app? > > > > Many thanks! > > Brad > > > > -- > > Posted via http://www.ruby-forum.com/. > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060627/34c1450e/attachment.html