Apidock - apidock.com - Recent notes
General Information:
Latest News:
expires_in option (ActionController::Caching::Fragments) 24 Aug 2013 | 10:08 pm
@concept47 do you really need to check the fragment in the controller? ActiveRecord will execute the query when its used “Lazy Loading” - http://m.onkey.org/active-record-query-interface
everything is ok (Hash#slice) 20 Aug 2013 | 11:56 am
Olefine, I’m not sure here is a good place for such questions (better use stackoverflow for example), but answer for your question is that Rails provide slice (and many other methods) not only for Has...
for finding content (ActiveRecord::FinderMethods#find_by_attributes) 17 Aug 2013 | 01:28 pm
it will use all the field related to particular table so you can find data by any table field like Table name => ABC(:id, :name, :address) if you want to find data related to id or name or address tha...
expires_in option (ActionController::Caching::Fragments) 15 Aug 2013 | 10:24 am
You can actually pass in an expires_in option that sets how long Rails should show the fragment before deleting it so as an example … This only used to work with memcached but it now works with other...
unuseful code (Hash#slice) 12 Aug 2013 | 06:27 pm
Why it use? Instead it, we may use
Not Supported on Memcached. (ActiveSupport::Cache::Store#delete_matched) 8 Aug 2013 | 12:31 am
Just an FYI, this is not supported on Memcached, so I would avoid it if you’re using FileStore and are planning on moving over to Memcached eventually.
Ajax calls no longer whitelisted (ActionView::Helpers::CsrfHelper#csrf_meta_tags) 25 Jul 2013 | 04:04 am
As of Rails 3.0.4 and 2.3.11, Ajax calls are no longer whitelisted. See: http://weblog.rubyonrails.org/2011/2/8/csrf-protection-bypass-in-ruby-on-rails/
Use strings as parameters, not booleans (ActionView::Helpers::FormHelper#check_box) 23 Jul 2013 | 07:31 pm
I just stumbled across this somewhere in our codebase. The first example is faulty, the second one is correct. and:
Nested i18n attributes (ActiveModel::Translation#human_attribute_name) 18 Jul 2013 | 06:07 pm
If you want to use nested attributes in a i18n file (like person :has_many => :addresses), write:
Difference between fullpath (ActionDispatch::Request#original_fullpath) 17 Jul 2013 | 12:20 am
From what I’ve seen, it looks like the difference between this and #fullpath is that this method doesn’t include parameters that weren’t in the original url (i.e. parameters that were sent via POST in...