Skip to content

Instantly share code, notes, and snippets.

// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
JQuery.ajaxSetup({
'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/javascript")}
})
$(function() {
$("a.rjs").click( function() {
// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
// jQuery.ajaxSetup({
// 'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/javascript")}
// })
$(function() {
$("a.rjs").click( function() {
$(function() {
$("a.rjs").click( function() {
alert("TEST");
$.ajax({
url: this.href+'.js',
dataType: "script",
beforeSend: function(xhr) {xhr.setRequestHeader("Accept", "text/javascript");}
});
return false;
});
$(document).ready(function() {
//Click on the link .about, load/append rails/info/properties into .result
//And slide the div down to show content
//Replacing prototype code, testing/learning purposes
$(".about").click(function() {
alert("HII");
$.ajax({
type: "GET",
url: "rails/info/properties",
cache: false,
class Post < ActiveRecord::Base
acts_as_taggable_on :tags
end
<h1>New post</h1>
<% form_for(@post) do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :subject %><br />
<%= f.text_field :subject %>
</p>
<p>
class BlogPost < ActiveRecord::Base
has_many :comments
acts_as_taggable_on :tag, :tag_date
validates_presence_of :subject, :content, :tag_list
def after_save
self.tag_date_list = self.created_at.split("-")[0..1]
end
end
class BlogPost < ActiveRecord::Base
after_save :create_date
has_many :comments
acts_as_taggable_on :tag, :tag_date
validates_presence_of :subject, :content, :tag_list
def create_date
self.tag_date_list = self.created_at.split("-")[0..1].join(" ").to_s
self.save
class BlogPost < ActiveRecord::Base
has_many :comments
acts_as_taggable_on :tag, :tag_date
validates_presence_of :subject, :content, :tag_list
after_create :create_date
def create_date
self.tag_date_list = self.created_at.split("-")[0..1].join(" ").to_s
self.save
class BlogPost < ActiveRecord::Base
has_many :comments
acts_as_taggable_on :tag_cat, :tag_date
validates_presence_of :subject, :content, :tag_cat_list
after_create :create_date
def create_date
self.tag_date_list = self.created_at.strftime('%Y %m')
self.save