Rails – check if record exists in has_many association
Try: current_user.items.exists?(params[:id]) Or current_user.items.exists?(@item.id)
Try: current_user.items.exists?(params[:id]) Or current_user.items.exists?(@item.id)
Use border-style: .signup-success input[type=”submit”], .signup-success input[type=”submit”]:active, .signup-success input[type=”submit”]:focus { width: 80%; background: transparent; color: #00AA66; border-color: #00AA66; border-style: solid; } or combined version (border-style, border-width and border-color in one): border: 2px solid #00AA66;
You can find a lot of information here: rbenv on github To list all available installation candidates: rbenv install -l To install a ruby version you need (for example): rbenv install 2.0.0-p643 So that you will only use this ruby version in this specific folder and not affect anything else you can do: rbenv local … Read more
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