Missed close tag
At the page http://apidock.com/rails/ActionView/Helpers/TagHelper/tag
.data()<\/tt> should be instead of .data()
Community contributions, tips, and corrections to the documentation. (1708 notes)
At the page http://apidock.com/rails/ActionView/Helpers/TagHelper/tag
.data()<\/tt> should be instead of .data()
Salvatore ferragamo pas cher, 30 ~ 70% de rabais! Salvatore ferragamo chaussures!Bienvenue à notre Salvatore ferragamo en ligne, la spécialité de vendre de Salvatore ferragamo Pas Cher style. inclure:ferragamo chaussures,ferragamo sac etc.Nous sommes...
ex:
require 'rubygems'
require 'bundler'
require 'active_support/core_ext'
require 'pp'
xml =
'<test id="appears">
<comment id="doesnt appear">
it worked
</comment>
<comment>
see!
</comment>
<comment />
</test>'
hash =...
In my view I wanted to do this <%= select_hour(@hour, :start => 8, :end => 12) %> but did not work. I looked at the documentation and have not seen anything like it. http://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html#method-i-select_hour
So I studied how it worked this helper....
I like drogus idea. But I wanted a cleaner one, so I created an unobtrusive JQuery script to have the same functionality.
Example Usage:
<%= form_for @post do |form| %>
Title: <%= form.text_field :title %>
Body: <%= form.text_field :body %>
Tags:
<div id="tag-list"></div>...
Code
root :to => 'projects#index', :as => 'foobar'
will generate a helper
foobar_path
In actions that may or may not be loaded via ajax I use: render :layout => !request.xhr? For an entire controller I might use something like: layout :has_layout?
private
def has_layout?
request.xhr? ? false : controller_name
end
What seems unusual is that layout true...
replaced by "class_attibute": http://apidock.com/rails/v3.2.1/Class/class_attribute
replaced by "class_attibute": http://apidock.com/rails/v3.2.1/Class/class_attribute
This is a very useful method if you want to to use a scope through an association:
class Book < ActiveRecord::Base
scope :available, where(:available => true)
end
class Author < ActiveRecord::Base
has_many :books
scope :with_available_books, joins(:books).merge(Book.availab...
If you want to override previously set order (even through default_scope), use reorder() instead.
E.g.
User.order('id ASC').reorder('name DESC')
would ignore ordering by id completely
===Controller
op = Operation.find(params[:id])
fname = "operation_#{op.id}_#{DateTime.now.to_i}.csv"
send_data op.export(params[:url_type]),
:type => 'text/csv; charset=iso-8859-1; header=present',
:disposition => "attachment; filename=#{fname}.csv"
=== export_csv
de...
To use exists scopes on default_scope , you can use something like:
class Article < ActiveRecord::Base
scope :active, proc {
where("expires_at IS NULL or expires_at > '#{Time.now}'")
}
scope :by_newest, order("created_at DESC")
default_scope by_newest
end
But, if yo...
In Rails 3.1 and higher, just use ruby's SecureRandom, e.g.
Before
ActiveSupport::SecureRandom.hex
After
SecureRandom.hex
If you're looking to take an array like [ 'don', 'draper' ] And get 'don draper'
Then use join instead: [ 'don', 'draper' ].join( ' ' )
#=> 'don draper'
Just as an FYI this function is destructive to the original String object.
name = 'draper' #=> "draper"
name.insert( 0, 'don ' ) #=> 'don draper'
name #=> 'don draper'
Just change your
proxy_owner
calls to
@association.owner
Found it here: http://mileszs.com/deprecation-warnings-for-proxyowner-in-rails