#RubyOnRails - 14 November 2018
« Back 1 day Forward 1 day »
[00:50:57]
hnanon:
Within an admin namespace (/admin/products/1/) I have the line: <%= link_to 'Remove', @product.collections.destroy(collection), method: :delete, data: { confirm: 'Are you sure?' } %>
[00:51:33]
hnanon:
When I go to that page, the actual collection is destroyed (without clicking the link!).
[00:54:53]
Radar:
You're telling it to delete that item immediately. That link should go to an action that runs that destroy code.
[00:55:56]
Radar:
Are you deleting the link between a product and its collection? Is that the intention?
[00:57:03]
Radar:
and it doesn't necessarily have to be called destroy. It could be called something like "unlink"
[01:04:43]
hnanon:
Can I pass two arguments to its named path...something like: admin_collection_products_path(@product, collection)?
[01:10:57]
hnanon:
So, something like admin_collection_product_path(product: @product, collection: collection).
[10:05:15]
morantron:
hi! is there a gem that provides an admin panel for managing translation YML files?
[10:05:31]
morantron:
how do you handle this so translations can be changed without dev intervention?
[10:06:06]
dionysus69:
https://stackoverflow.com/questions/32600912/rails-4-manage-file-based-translations-at-admin-end
[16:18:17]
logik-bomb:
I'm trying to add a published_at to my model when the attribute is_published gets set. How can I execute this from my model? I'm trying with after_save :set_published_date, :if => Proc.new{ self.published_changed? } without much success. Thanks
[16:38:41]
pavelz:
anyone knows about turbolinks? i had to upgradet to versions 5 and now when going over to older pages I get servied a cached version and a few seconds later it refreshes
[17:29:38]
_aeris_:
[13] pry(main)> ActionController::Parameters.new.permit(settings: {}).fetch(:settings, {}).to_hash
[17:29:40]
_aeris_:
ActionController::UnfilteredParameters: unable to convert unpermitted parameters to hash
[17:30:03]
_aeris_:
strange to have this error because i allow anything on settings with the permit…
[19:24:29]
ryandv:
Hi all - I'm reading through the Rails 5 source and am curious about the class attribute `attributes_to_define_after_schema_loads` - how is it used? From what I can tell, a cursory glance over the source suggests that it is unused
[19:24:45]
ryandv:
Is this something that is configurable by the user? I somehow doubt this as there is an internal annotation on the attribute
[19:33:00]
ryandv:
it appears to contain all those activerecord attributes defined in an `attribute` class macro call
[19:33:38]
ryandv:
which I guess is distinguished from those attributes coming straight from the model schema
[22:43:04]
Maletor:
I'm getting undefined method `close' for #<String:...> when using config.cache_store = :file_store.
[22:43:19]
Maletor:
from activesupport-5.2.1/lib/active_support/core_ext/file/atomic.rb:24:in `atomic_write'
[22:56:13]
helpa:
maletor: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[22:57:11]
Radar:
maletor: Can you add # ./app/models/user.rb:895 and the containing method to the Gist too please?
[22:58:04]
Maletor:
Radar: for context i run Rails.cache.fetch in other places of my test suite with no issue
[22:59:31]
Radar:
Right, but there's only a few moving parts here. Set the cache_store, copy over the method...
[23:02:35]
Radar:
The block there shouldn't be returning a string. iirc, it should be returning a Tempfile.
[23:03:13]
Radar:
https://github.com/rails/rails/blob/v5.2.1/activesupport/lib/active_support/core_ext/file/atomic.rb#L24
[23:08:36]
Radar:
Ok, but how does the string 99016 arrive in there? Did you follow it all the way from user.rb?
[23:14:29]
Maletor:
so far seeing 3 writes within the spec to the cache, the one we care about is "/app/tmp/cache/10A/2E0/99016"
[23:21:38]
Maletor:
Radar: https://gist.github.com/maletor/cb99d963ea6e0198e23d6e68a7020278#gistcomment-2759915
[23:24:16]
Maletor:
Radar: this one is seriously weird: https://gist.github.com/maletor/cb99d963ea6e0198e23d6e68a7020278#gistcomment-2759918