There are 801 cards with this tag.
There are 1 decks with cards that have this tag.
rails - where email is not "jack@gmail.com" or "steve@gmail.com"
where("email != ? AND email != ?", "jack@gmail.com", "steve@gmail.com")
#note the need to write out the email != expression again twice
- View
- 0 likes
you have a named scope red_items
how to check if you have any matches in db
red_items.exists? #=> true
- View
- 0 likes
rails - does this run the edit action in controller
render :action => "edit"
no - just the view called action
simplify with:
render "edit"
- View
- 0 likes
ActiveRecord#update_all is used to
Mass update many objects
# Conditions from the current relation also works
Book.where('title LIKE ?', '%Rails%').update_all(:author => 'David')
- View
- 0 likes
rails - what does .to_xml do?
creates an xml document to represent the model
<topic>
<title> Topic 1 </title>
<author-name> Jack </author-name>
etc,
every attribute present
- View
- 0 likes
you have a polymorphic Comment model that refers to its association as commentable. What code goes in an Article model to associate a comment?
has_many :comments, :as => :commentable
- View
- 0 likes
rails - you want a controller namespaced under FacebookApp but you want the route to be trackings_path instead of a namespaced facebook_app_trackings_path
scope :module => :facebook_app do
resources :trackings
end
- View
- 0 likes
rails - is before_validation called before or after before_save
before_validation is called before before_save
- View
- 0 likes
syntax for creating a compound index in migrations
add_index :conversations, [:created_at, :language_code]
# used when you are querying by both fields at once
- View
- 0 likes
how does validates uniqueness of fail if an attribute is left blank
it doesn't fail the first time.. rather it fails the second time as you are saving nil twice (un-unique)
- View
- 0 likes
rails - apply a default 'jpg' :format param to this route
match 'photos/:id' => 'photos#show'
match 'photos/:id' => 'photos#show', :defaults => { :format => 'jpg' }
- View
- 0 likes
-
- Previous
- Page 1 of 67
- Next
- There are 801 results.