Rails Error Can’t Find freedesktop.org.xml
Found some links to shared-mime-info on the GitHub link I posted, and I solved the issue by running the command below and starting a new project: brew install shared-mime-info
Found some links to shared-mime-info on the GitHub link I posted, and I solved the issue by running the command below and starting a new project: brew install shared-mime-info
There are four types of callbacks accepted by the callback macros: Method references (symbol), callback objects, inline methods (using a proc), and inline eval methods (using a string). Try this? after_update -> { cache_bust(true) }
Consolidating answers and adding a little: Most of this is on this page on the wiki (or I’ll put it there soon). Within the file that registers your model for activeadmin (e.g. app/admin/user.rb), you can have ActiveAdmin.register User do # a simple string index :title => “Here’s a list of users” do … end # … Read more
(Having just gone through a 4.2 to 5.2 Rails upgrade, I’ll write a more complete answer.) Rails 5.0 Starting with Rails 5, the Rails team decided to generate an initializer, config/initializers/new_framework_defaults.rb, that contained values for new configuration defaults. This file is generated for both new (rails new) Rails 5.0 applications and applications updated (rake app:update) … Read more
NB: tried to do a detailed answer below poke’s one, but it doesn’t seem to be possible, so I will answer here. I think using 422 for validation errors is fine. The Webdav RFC doesn’t say 422 means “semantic errors”, it says the server was “unable to process the contained instructions” (see https://www.rfc-editor.org/rfc/rfc4918#section-11.2). “Semantic errors” … Read more
Assuming you installed PostgreSQL on Windows with the PostgreSQL “One-click” installer packaged by EnterpriseDB, psql is not added to the PATH automatically. That’s partly because adding it to the path could otherwise cause confusion when people have multiple versions of PostgreSQL installed. You need to specify the full explicit path to psql, eg: “%PROGRAMFILES%\Postgresql\9.2\bin\psql.exe” or … Read more
Maybe you can use json.merge!. json.merge! notification.attributes https://github.com/rails/jbuilder/blob/master/lib/jbuilder.rb#L277
I suggest you use Dir.entries(“target_dir”) Check the documentation here
Since MySQL indexes are already case-insensitive, I’m guessing you’re dealing with PostgreSQL, which creates case-sensitive indexes by default. I’m answering here based on Rails 3.2.3 and PostgreSQL 8.4. It seems functional indexes are one more example of things that ActiveRecord can’t generate. Foreign keys and UUID columns are two more that come to mind. So … Read more
Rails has a convenience method for calculating the beginning of the week. irb(main):001:0> Date.today.beginning_of_week(:sunday) #=> Sun, 16 Dec 2012 See the Date Rails extensions for other possibilities: http://api.rubyonrails.org/classes/Date.html Update: Rails 5.2 adds convenience methods to find the next/previous occurrence of a day. [1] pry(main)> Date.today.prev_occurring(:sunday) #=> Sun, 29 Apr 2018 See the DateAndTime::Calculations documentation for … Read more