Skip to content

Instantly share code, notes, and snippets.

class Blogpost < ActiveRecord::Base
acts_as_taggable_on :tagcategories
def created_at
"#{created_at.strftime("%y%m%d - %H:%m")}"
end
end
class BlogpostsController < ApplicationController
before_filter :blogpost_find_id, :only => [:show, :edit, :update, :destroy]
#Why can't I add :new here, it works when I dont have it there.
#But the http://guides.rubyonrails.org/getting_started.html
#Has it under def new;
before_filter :respond_to_id, :only => [:show, :update]
def index
class BlogpostsController < ApplicationController
before_filter :blogpost_find_id, :only => [:show, :edit, :update, :destroy]
before_filter :respond_to_id, :only => [:show, :new]
def blogpost_find_id
@blogpost = Blogpost.find(params[:id])
end
def index
@blogposts = Blogpost.find(:all)
respond_to do |format|
class BlogpostsController < ApplicationController
before_filter :blogpost_find_id, :only => [:show, :edit, :update, :destroy]
before_filter :respond_to_id, :only => [:show, :new]
def respond_to_id
respond_to do |format|
format.html
format.xml { render :xml => @blogpost }
end
end
jQuery.ajaxSetup({
'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/javascript")}
})
jQuery(document).ready(function($) {
$('div.pagination a').livequery('click', function() {
$('div.main').load(this.href)
return false
})
})
We couldn’t find that file to show.
//application.js
jQuery(document).ready(function($) {
$('div.pagination a').livequery('click', function() {
//alert("hey");
$('div.main').load(this.href);
return false
})
})
has_attached_file :image,
:path => ":rails_root/public/images/photos/:id_:style_:basename.:extension",
:url => "/images/photos/:id_:style_:basename.:extension",
:styles => { :medium => "300x300>", :thumb => "100x100>" }
class Post < ActiveRecord::Base
require 'RedCloth'
has_many :photos
liquid_methods :photo
#I want to pass in { photo 1 } to the render. Where 1 is an integer
#Look at def render. @photo is that integer. However I get an error
#Liquid error: undefined local variable or method `photos’ for #
class PhotoPicker < Liquid::Tag
class Post < ActiveRecord::Base
require 'RedCloth'
has_many :photos
liquid_methods :post, :photo, :photos, :posts #Testing everything I can
#I want to pass in { photo 1 } to the render. Where 1 is an integer
#Look at def render. @photo is that integer. However I get an error
#Liquid error: undefined local variable or method `photos’ for #