Sam Grönblom | 9 Feb 04:29
Picon
Gravatar

memoize and invalidation - backwards?

Maybe this is because I'm missing something but it seems to me that
asking users of a memoized method to know when the method needs to be
reloaded is a bit backwards. To me it seems like whoever is messing
with something that affects the results of the memoized function
should be the one that after doing its work should call something like
memoized_method(:reset). Thoughts?

--

-- 
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core <at> googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-core+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.

Santiago Palladino | 31 Jan 16:05
Picon
Gravatar

Method for checking if an object can be destroyed based on its dependent restrict associations

I have added a small method for checking if an object can be destroyed
by checking if its associations marked as dependent restrict are empty
or not. Since it seems something common to do, I wanted to ask if you
think it is worth adding it to ActiveRecord, in which case I can fork
it and add the change (as well as tests and doc), as described in
http://guides.rubyonrails.org/contributing_to_ruby_on_rails.html

The gist for the monkeypatch I am doing now in the app is
https://gist.github.com/1710839

My apologies if this is not the appropriate channel for discussing
this. If it is not, I would appreciate some advice regarding where to
ask this question or how to proceed.

Thanks!

--

-- 
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core <at> googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-core+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.

eduludi | 1 Feb 13:37
Picon
Gravatar

ActiveResource Associations

Hi! I want to know why this pull request (https://github.com/rails/
rails/pull/70) was not merged to master yet. This feature is very
usefull! Any idea? Thanks!

--

-- 
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core <at> googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-core+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.

thoughtafter | 28 Jan 11:36
Picon
Gravatar

Buffered logs in Rails 3.2.1

I just upgraded my first application to Rails 3.2.1.  It's been pretty
smooth which I appreciate.  However I have noticed that my production
log is now buffered.  It use to flush on every response but now it
does not.  I would like to restore the previous behavior bug I have
not found any information on how to do so.  If anyone knows how to do
this I would appreciate hearing it.

Thank you.

--

-- 
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core <at> googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-core+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.

Matt Jones | 5 Feb 00:12
Picon

Interoperating ActiveResource and ActionController::Responder

I've just created a pull request to finally make ActiveResource correctly handle validation errors
returned from ActionController::Responder's default JSON handling code. The code also handles the
format produced by pre-3.2 Responders *and* the format previously expected by ActiveResource, so it
shouldn't break in any application that was working before.

https://github.com/rails/rails/pull/4881

Would appreciate any feedback - it would be nice for the framework to actually work with its own API endpoints...

Thanks,

--Matt Jones

--

-- 
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core <at> googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-core+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.

Claudio Poli | 27 Jan 07:26
Picon
Gravatar

to_json performance

Originally posted on github, reported to the right place.

I would like to open a discussion about how `to_json` and `as_json`
operates in Rails from a performance standpoint.

I'm using Rails 3.2 but this issue applies to almost all versions of
Rails.

Our use case presents the challenge in sending out potentially large
JSON (or XML, but we'll focus on JSON rendering here) bodies as a
response of a API calls that runs through a normal Rails controller.

Someone states that if you are sending out more than 1MB of data
"you're doing it wrong".
I respectfully disagree, as there are different cases, based also on
what an application should do and is designed for.

There can be few major bottlenecks in rendering JSON as fast as
possibile from start to finish, three of them are:

* database query
* AR objects instantiation
* collection transformation in JSON

I'll exclude the AR timings, so let's tackle the first problem, AR
objects.

Having a result set of 50k entries is obviously painful, and doing it
with AR it will kill your instance, no questions asked.
Worse, in my use case this result set can be asked frequently from the
(Continue reading)

B.Tag | 9 Jan 13:35
Picon

After updating Ruby on Rails, I have the following problem

After updating Ruby on Rails, I have the following problem?

/usr/local/lib/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find rails (>= 0) amongst [rubygems-update-1.8.12] (Gem::LoadError)
from /usr/local/lib/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /usr/local/lib/site_ruby/1.9.1/rubygems.rb:1208:in `gem'
from /usr/local/bin/rails:18:in `<main>'

:~$ sudo gem update --system
[sudo] password for b-tag: 
Latest version currently installed. Aborting.

:~$ sudo update_rubygems 
RubyGems 1.8.14 installed

== 1.8.14 / 2012-01-05

* 2 bug fixes:

  * Ignore old/bad cache data in Version
  * Make sure our YAML workarounds are loaded properly. Fixes #250.


------------------------------------------------------------------------------

RubyGems installed the following executables:
/usr/bin/gem1.9.1


Done the above steps, the result is the same

:~$ sudo gem install rails
ERROR:  Could not find a valid gem 'rails' (>= 0) in any repository
ERROR:  Possible alternatives: rails

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core <at> googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-core+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Santiago Pastorino | 4 Jan 22:06
Gravatar

[ANN] Rails 3.2.0.rc2 has been released

Hi everyone,

Rails 3.2.0.rc2 has been released. **Update your Gemfile to depend on
sass-rails ~> 3.2.3**

## IMPORTANT

**Support for Rails 2.3-style plugins (vendor/plugins!) will be
removed in Rails 4.0. Move them out and bundle them in your Gemfile,
or fold them in to your app as lib/myplugin/* and
config/initializers/myplugin.rb**

## CHANGES since RC1

*ActionMailer*

* No changes

*ActionPack*

*   Add font_path helper method **Santiago Pastorino**

*   Depends on rack ~> 1.4.0 **Santiago Pastorino**

*   Add :gzip option to `caches_page`. The default option can be
configured globally using `page_cache_compression` **Andrey Sitnik**


*ActiveModel*

* No changes

*ActiveRecord*

* No changes

*ActiveResource*

* No changes

*ActiveSupport*

*   ActiveSupport::Base64 is deprecated in favor of ::Base64. **Sergey
Nartimov**


*Railties*

*   Rails 2.3-style plugins in vendor/plugins are deprecated and will
be removed in Rails 4.0. Move them out of vendor/plugins and bundle
them in your Gemfile, or fold them in to your app as lib/myplugin/*
and config/initializers/myplugin.rb. **Santiago Pastorino**

*   Guides are available as a single .mobi for the Kindle and free
Kindle readers apps. **Michael Pearson & Xavier Noria**

*   Allow scaffold/model/migration generators to accept a "index" and
"uniq" modifiers, as in: "tracking_id:integer:uniq" in order to
generate (unique) indexes. Some types also accept custom options, for
instance, you can specify the precision and scale for decimals as
"price:decimal{7,2}". **Dmitrii Samoilov**


## SHA-1

* MD5 (actionmailer-3.2.0.rc2.gem) = 118c83b2cddaa935d1de7534cfb6c810
* MD5 (actionpack-3.2.0.rc2.gem) = 6b18851bc26d5c8958672f27adda05ca
* MD5 (activemodel-3.2.0.rc2.gem) = d82f4eed949dcff17f8bf2aed806679a
* MD5 (activerecord-3.2.0.rc2.gem) = d07806fd5fc464f960200d20ceb2193a
* MD5 (activeresource-3.2.0.rc2.gem) = f51af240ff4623b0b6f8a4293ffa50dc
* MD5 (activesupport-3.2.0.rc2.gem) = 01380240c12e0380c9e61c97dd45f2f1
* MD5 (rails-3.2.0.rc2.gem) = 134f923f7d821f514abf6bdf4af62ca7
* MD5 (railties-3.2.0.rc2.gem) = 4b3ac0f9c5da16b90a1875e8199253d2

You can find an exhaustive list of changes on
[github](https://github.com/rails/rails/compare/v3.2.0.rc1...v3.2.0.rc2).
Along with the [closed issues marked for
v3.2.0](https://github.com/rails/rails/issues?milestone=3&state=closed).

You can also see issues [we haven't closed
yet](https://github.com/rails/rails/issues?milestone=3&state=open).

Thanks to everyone!

--

Santiago Pastorino
WyeWorks Co-founder
http://www.wyeworks.com

Twitter: http://twitter.com/spastorino
Github: http://github.com/spastorino

--

-- 
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core <at> googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-core+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.

Nick Sutterer | 4 Jan 18:13
Picon
Gravatar

Routing + ActionController::TestCase

Hi, just wondering why it makes sense to verify routing in an
AC::TestCase test.

class XX < ActionController::TestCase
    it "returns an empty cart" do
      post :create
      ...
    end
  end

If I have no routing set up:

Failure/Error: post :create, :format => "json"
     No route matches {:controller=>"carts", :action=>"create"}

Since I only wanna test my controller action why would I need routing?
Any hints on this, or is this just a relict that can be removed?

Nick

--

-- 
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core <at> googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-core+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.

digger69 | 4 Jan 00:49

ActionMailer decoding multi-part w/ charset

I am using ActionMailer to parse incoming email from gmail. I found
that multi-part emails coming from Outlook clients are encoded with
charset='Windows-1252'. After creating a mail object (see
Receiver.receive() below) each part.body has charset='UTF-8' and
defaulted_charset=true. When I grab part.body.to_s the characters
aren't encoded correctly (hyphen encoded as =96 results in non-
printable char in UTF-8 string from to_s). I was assuming it would
grab the charset off the part header, but didn't see anything in
initialize that would do that (seems biased for composing email rather
than parsing existing).

Is this a limitation, defect, or just my ignorance? Thanks for any
help. As a workaround, I'm calling force_encoding() on the string and
then explicitly encoding to UTF-8.

Mark

Rails 3.0.10

class Receiver < ActionMailer::Base
  def receive(email)
    email
  end
end

--

-- 
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core <at> googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-core+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.

Nicolas Buduroi | 3 Jan 20:09
Picon
Gravatar

Deprecation warning for nested I18n namespace lookup no longer supported.

Hi, I'm not sure "I18n namespace lookup" mean but there's some
libraries (like https://github.com/nofxx/symbolize) that use nested
key in a way that I find perfectly logical, so I wonder if that
warning isn't superfluous as there might be a lot of useful ways to
leverage the AR locales that are legit and outside Rails control. In
the end I'm really not sure deprecation warnings make sense for what
is essentially data!

--

-- 
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core <at> googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-core+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.


Gmane