[Rails] streaming XML in rails 3.1 with ruby 1.9.2

2011-09-16 Thread Marcelo Barbudas
Hi. I'm trying to get streaming to work on a rails 3.1 app with ruby 1.9.2. The action sends a big XML file. The file looks like: <% @files do |f| -%> <%= render_file_source_xml(f).html_safe -%> <% end %> I would like the render_file_source_xml call to be streamed as it's processed. Is it po

[Rails] streaming with rails 3.1 and ruby 1.8.7

2011-09-15 Thread Marcelo Barbudas
Hey! I'm working with an app where migrating to ruby 1.9.2 is currently not an option, so I can not use Rails 3.1 streaming. One of the features is sending large XML and CSV files. In Rails 3.0 I used the self.response_body {} hack which worked pretty OK. This stopped working in Rails 3.1. Ho

[Rails] upgrade to Rails3 question

2010-09-30 Thread Marcelo Barbudas
Hi! After upgrading to Rails3 and the latest plugins, two of the plugins: delayed_job and oauth_plugin don't work. They display a similar problem, I am not able to use methods they provide. In delayed_job's case I can't use Model.delay.method (undefined method) and with oauth_plugin adding oauthe

[Rails] template.base_path in rails3

2010-09-24 Thread Marcelo Barbudas
Hi! With Rails 2 template.base_path and template.name were available in views. What are the Rails3 equivalents? -- M. -- 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-t...@googlegroups.co

[Rails] rails3 xss escaping

2010-08-30 Thread Marcelo Barbudas
Hi. Is there a way to disable the default xss escaping of everything in rails3? What's the proper way of doing string concatenations like below with rails3 if xss escaping can not be disabled: "something #{link_to('something else') if value == true}" -- M. -- You received this message because

[Rails] disable erubis xss escaping

2010-06-06 Thread Marcelo Barbudas
Hi. Is there a way to disable erubis auto escaping? I understand the implications, and in our project everything in sanitized during input. On the other hand, we use a lot of: <%= "#{translate something} value #{translate another thing} #{link_to ..}" if something else %> Because of string inter

[Rails] which views are rendered for an URL

2010-04-19 Thread Marcelo Barbudas
Hi, Is there a way I can figure out which files are run for a specific URL? Given http://www.planet.com/countries files like: countries/ index.html.erb, countries/_country.html.erb, layouts/ application.html.erb and so on. Thank You -- M. -- You received this message because you are subscribe

[Rails] which files are rendered for an URL

2010-03-10 Thread Marcelo Barbudas
Hi, Is there a way I can figure out which files are run for a specific URL in a controller or a script? Given http://www.planet.com/countries files like: countries/ index.html.erb, countries/_country.html.erb, layouts/ application.html.erb and so on. Thank You -- M. -- You received this messa

[Rails] Re: one rails, multiple DBs

2010-02-10 Thread Marcelo Barbudas
Hi. > > > It's a high volume app, that's written as a standalone service. > > Extending it as a hosted solution and keeping updates nice is a big > > part of what the project is about. > > And all of that would be easier with one big DB, at least as far as > you've described. > You are right, it w

[Rails] Re: one rails, multiple DBs

2010-02-10 Thread Marcelo Barbudas
Hi, > Generally, you don't need a separate DB for each subdomain.  One big DB > is usually better. It's a high volume app, that's written as a standalone service. Extending it as a hosted solution and keeping updates nice is a big part of what the project is about. -- Cheers, M. -- You receive

[Rails] one rails, multiple DBs

2010-02-10 Thread Marcelo Barbudas
Hi. I'm in a situation where I have to provide a hosted Rails App solution. I'm running Apache with passenger in the backend. What is the proper way to change the DB depending on the subdomain? Should I use data_fabric? -- R. -- You received this message because you are subscribed to the Googl

[Rails] api routes with versions

2009-10-24 Thread Marcelo Barbudas
Hi, I've been trying to implement a versioned API, I went through different versions that I didn't like. I am wondering if I can do something like this with routes, and if it's possible how can it be implemented: api.example.com/items/show.xml works, no version api.example.com/v1/items/show.xml

[Rails] theme support alternative

2009-09-21 Thread Marcelo Barbudas
Hi. Is there any alternative to the theme support plugin? I know it has been ported to 2.3 by James Steward(which did an awesome job). At the same time I am worried that coming 3.0 everything in that code will break. I am at the beginning of the dev cycle for themes so I would prefer a newer, p

[Rails] Re: maintaining multiple API versions

2009-09-13 Thread Marcelo Barbudas
> With routing. > > Start off with api.startup.com/v1/session/create, then move on to > api.startup.com/v2/session/create, etc. > Interesting. That would be a pretty solution. What's the best way to provide backwards compatibility using this model? Should I have XML views that implement: if ver

[Rails] maintaining multiple API versions

2009-09-12 Thread Marcelo Barbudas
Hi. What's beautiful about Rails is that it provides the incredibly easy system for API building. At the same time once you grow and production test the application you start finding that you can make the API interface even better. But you have to break backward compatibility. How do you handle

[Rails] actionmailer and local i18n

2009-07-24 Thread Marcelo Barbudas
Hi, When sending mails often enough they are sent to another party than the current logged in user (like when commenting on a blog), and that user can have another default i18n. It would be nice to be able to specify a local I18n for ActionMailer. There is a plugin that does this: http://github

[Rails] actionmailer and i18n

2009-07-02 Thread Marcelo Barbudas
Hi, When sending mails often enough they are sent to another party than the current logged in user (like when commenting on a blog). It would be nice to be able to specify a local I18n for ActionMailer. There is a plugin that does this: http://github.com/Bertg/i18n_action_mailer In my case it

[Rails] catching missing translations

2009-05-31 Thread Marcelo Barbudas
Hi. Is it possible to catch globally missing translations? I want to see if users arrive at a page without one or more translations, and receive via email the missing key string and page. -- M. --~--~-~--~~~---~--~~ You received this message because you are subsc

[Rails] i18n and count question

2009-05-28 Thread Marcelo Barbudas
Hi. What is the proper way to handle situations where you need pluralization with and without adding the count? The best I could think of is to write it twice: item: one: 'item' other: 'items' c_item: one: 'one item' other: '{{count}} items' It's not very DRY. I guess there should be

[Rails] ferret, will_paginate and group by

2009-04-25 Thread Marcelo Barbudas
Hi, Is it possible to use "find_with_ferret" and GROUP BY together? Count(*) doesn't return what will_paginate expects when using GROUP BY, and AFAIK a workaround for that is to manually get total_entries and pass it to Model.paginate. However how does that work with find_with_ferret where I ha

[Rails] p3p policy and rails 2.3

2009-04-09 Thread Marcelo Barbudas
Hi, Has anyone encountered a problem where IE6 rejects all P3P policies sent by Rails/Nginx? I had a simple setup that worked in 2.2.2 and it doesn't anymore: Server: nginx/0.6.32 Date: Fri, 10 Apr 2009 00:03:36 GMT Content-Type: text/html; charset=utf-8 Connection: keep-alive Set-Cookie: _app_

[Rails] after_create and after_save

2009-03-29 Thread Marcelo Barbudas
Hi, AFAIK after_create is called after_save if the entry does not exist in the DB. Is there a way to tell if a specific model is new or not in after_save? I have to do something like: def after_save add_to_history 'save' end def after_create add_to_history 'create' end However after_save

[Rails] Re: scaling full text indexing(ferret vs solr vs hyperstraie

2009-03-08 Thread Marcelo Barbudas
> With Ferret you can scale reads horizontally: you can have multiple read > servers on a single index. You can only have one write server on a > single index or you'll risk data corruption. > > Another strategy is partitioning: having separate indices for buckets of > data. Each index could run o

[Rails] scaling full text indexing(ferret vs solr vs hyperstraier)

2009-03-08 Thread Marcelo Barbudas
Hi, Does any have experience scaling full text search in RoR? Right now our project is running a simple setup with ferret and acts_as_ferret. We are thinking about deploying a feature that would send 50x more search requests. So we probably have to rethink our solution. How do services like sea

[Rails] activerecord access raw serialized data

2009-02-01 Thread Marcelo Barbudas
Hi, I have a model with a serialized field 'other_data'. How can I add raw YAML data to that field? If i try: model[other_data] = yaml_formatted_data yaml_formatted_data gets YAML formatted again. -- cheers, M. --~--~-~--~~~---~--~~ You received this message bec

[Rails] RJS form validation

2008-12-28 Thread Marcelo Barbudas
Hi. I'm trying to add and validate objects using RJS. I have a page where if a user clicks on a link a form partial is inserted via javascript(depending on the click). If that form is valid I would like to remove it and display the object, otherwise rewrite the form with the errors inline(next

[Rails] subselects and associations(:include)

2008-12-22 Thread Marcelo Barbudas
Hi. Is there a way to stop rails from tokenizing a mysql query? I have an association where I need to change :select to: :select => "*, (select count(something_id) from second_table where second_table.something_id = main_table.id ) as count" It works OK without loading associations, however

[Rails] strptime and localization

2008-11-23 Thread Marcelo Barbudas
Hi, My project uses Date::MONTHNAMES and Date::ABBR_MONTHNAMES for localization. I've run into an issue where I need to use strptime to parse a localized string. Has anyone run into this? How did you fix it? -- M. --~--~-~--~~~---~--~~ You received this messag

[Rails] Re: to_xml and helper methods

2008-11-12 Thread Marcelo Barbudas
gt; > class MyObject < ActiveRecord::Base >   def helper_method(obj) >     "something-from-obj-#{obj.id}" >   end > >   defto_xml >     xml = super >     close_tag = "" >     xml.gsub(close_tag, "  #{self.helper_method(self)}\n#{close_tag}&

[Rails] to_xml and helper methods

2008-11-10 Thread Marcelo Barbudas
Hi, I have an array with objects and I want to generate an XML like: 1 result 1 2 result 2 The helper method generates some urls and it needs as an arguments the object. What would be a proper way to include the result of that method call? I guess bui

[Rails] disable protected attributes for create or save

2008-10-29 Thread Marcelo Barbudas
Hi, Is there a way to temporarily disable attr_protected for create and save method calls? Something like save_without_protected... -- M. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.

[Rails] to_xml associations and :only

2008-10-28 Thread Marcelo Barbudas
Hi, A call to to_xml(:only => [:field], :include => :association]) will filter the association result too(the resulting association will only have :field). Is there a way around this? I want to specify different filters for the main object and the association. -- M. --~--~-~--~~---

[Rails] http autentication and restful_authentication

2008-10-11 Thread Marcelo Barbudas
Hi, I've started the long task of adding an API to a project of mine. Since I need to write a PHP library for it I will use for inspiration the one for Basecamp(http://github.com/quirkey/basecamphp/). However that library uses http authentication, and I have a setup with restful_authentication(

[Rails] Re: rails API best practices

2008-10-10 Thread Marcelo Barbudas
> If you haven't read the docs for ActiveResource, I'd start there. > One of the tasks of my project is that I have to create a PHP library that people can use to connect to this application. Is there a library that implements a PHP - RoR XML connection? -- M. --~--~-~--~~--

[Rails] rails API best practices

2008-10-09 Thread Marcelo Barbudas
Hi, Is there a book or screencast or documentation that provides best practices for creating an API for a RoR application? I have to build an API from scratch and I have no idea where to start. -- M. --~--~-~--~~~---~--~~ You received this message because you are