How to use my view helpers in my ActionMailer views?
In the mailer class that you are using to manage your emails: class ReportMailer < ActionMailer::Base add_template_helper(AnnotationsHelper) … end
In the mailer class that you are using to manage your emails: class ReportMailer < ActionMailer::Base add_template_helper(AnnotationsHelper) … end
I found here an undocumented option to create a new application using an older version of Rails. rails _2.1.0_ new myapp
An ActiveRecord object lifecycle: 1.new record item = Item.new item.new_record? #=> true 2.persisted item.save item.persisted? #=> true 3.changed item.name = “other” item.changed? #=> true 4.destroyed item.destroy item.destroyed? #=> true
Because Rails provides structure in terms of MVC, it’s natural to end up using only the model, view, and controller containers that are provided for you. The typical idiom for beginners (and even some intermediate programmers) is to cram all logic in the app into the model (database class), controller, or view. At some point, … Read more
The answer was: heroku restart -a app_name # The -a is the same as –app Easily aliased with alias hra=”heroku restart –app ” Which you can make a permanent alias by adding it to your .bashrc or .bash_aliases file as described at: https://askubuntu.com/questions/17536/how-do-i-create-a-permanent-bash-alias and Creating permanent executable aliases Then you can just type hra app_name … Read more
I do this: <% some_local = default_value if local_assigns[:some_local].nil? %>
Figured it out, the task should look like: namespace :test do task :new_task => :environment do puts Parent.all.inspect end end Notice the => :environment dependency added to the task
Got the answer HERE for windows, it says there that: curl -XPUT ‘http://localhost:9200/api/twittervnext/tweet’ Woops, first try and already an error: curl: (1) Protocol ‘http not supported or disabled in libcurl The reason for this error is kind of stupid, Windows doesn’t like it when you are using single quotes for commands. So the correct command … Read more
Basically destroy runs any callbacks on the model while delete doesn’t. From the Rails API: ActiveRecord::Persistence.delete Deletes the record in the database and freezes this instance to reflect that no changes should be made (since they can’t be persisted). Returns the frozen instance. The row is simply removed with an SQL DELETE statement on the … Read more
I just fixed a similar issue on my system. You need to rebuild your install of Ruby 2.1.2 and it will re-link against the newly-updated SSL. $ rbenv install 2.1.2 rbenv: /Users/ryan/.rbenv/versions/2.1.2 already exists continue with installation? (y/N) y Downloading ruby-2.1.2.tar.gz… -> http://dqw8nmjcqpjn7.cloudfront.net/f22a6447811a81f3c808d1c2a5ce3b5f5f0955c68c9a749182feb425589e6635 Installing ruby-2.1.2… Installed ruby-2.1.2 to /Users/ryan/.rbenv/versions/2.1.2