This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Blogpost < ActiveRecord::Base | |
acts_as_taggable_on :tagcategories | |
def created_at | |
"#{created_at.strftime("%y%m%d - %H:%m")}" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
}) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//application.js | |
jQuery(document).ready(function($) { | |
$('div.pagination a').livequery('click', function() { | |
//alert("hey"); | |
$('div.main').load(this.href); | |
return false | |
}) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 # |