In your view:
<%= link_to "Load more", posts_path(@posts, page: @posts.current_page+1), id: "load-more-posts", remote: true %>
In your controller:
respond_to :html, :js, only: [:index]
def index
➜ frontend git:(master) ✗ ember server --proxy=http://127.0.0.1:8080 | |
version: 0.0.39 | |
Proxying to http://127.0.0.1:8080 | |
Livereload server on port 35729 | |
Serving on http://0.0.0.0:4200 | |
frontend/components/gravatar-image.js: line 1, col 16, 'Ember' is not defined. | |
frontend/components/gravatar-image.js: line 5, col 50, 'md5' is not defined. | |
2 errors |
module Abilities | |
def self.ability_for(user) | |
if user.admin? | |
AdminAbility.new(user) | |
else user | |
MemberAbility.new(user) | |
else | |
GuestAbility.new | |
end | |
end |
In your view:
<%= link_to "Load more", posts_path(@posts, page: @posts.current_page+1), id: "load-more-posts", remote: true %>
In your controller:
respond_to :html, :js, only: [:index]
def index
# encoding: UTF-8 | |
# This file is auto-generated from the current state of the database. Instead | |
# of editing this file, please use the migrations feature of Active Record to | |
# incrementally modify your database, and then regenerate this schema definition. | |
# | |
# Note that this schema.rb definition is the authoritative source for your | |
# database schema. If you need to create the application database on another | |
# system, you should be using db:schema:load, not running all the migrations | |
# from scratch. The latter is a flawed and unsustainable approach (the more migrations | |
# you'll amass, the slower it'll run and the greater likelihood for issues). |
За тэгвэл чадлынхаа хэрээр тайлбарлах гээд үзье: Ангилалуудаа categories гэсэн хүснэгтэнд хадгальяа, | |
тэр хүснэгт нь id, name, ancestry гэсэн талбаруудтай. | |
Хамгийн эхний өгөгдөл буюу A-г хийхэд дараах байдалтай болно. | |
id|name|ancestry | |
1|A|null | |
Өөрөөр хэлбэл A нь root болно. Одоо B-г нэмвэл: | |
id|name|ancestry |
var Ability, ability, as_array, is_array, is_array_contains_array; | |
if (!Array.prototype.unique) { | |
Array.prototype.unique = function() { | |
var key, output, value, _i, _ref, _results; | |
output = {}; | |
for (key = _i = 0, _ref = this.length; 0 <= _ref ? _i < _ref : _i > _ref; key = 0 <= _ref ? ++_i : --_i) { | |
output[this[key]] = this[key]; | |
} | |
_results = []; |
# Hooks | |
unless Array::unique | |
Array::unique = -> | |
output = {} | |
output[@[key]] = @[key] for key in [0...@length] | |
value for key, value of output | |
unless Array::contains_array | |
Array::contains_array = (arr)-> | |
@.every (val)-> |
private native void nativeMe() | |
{ | |
// Энд доод түвшний кодоо бичээрэй. | |
} |
# Өгөгдөл 1 | |
овог: Болд | |
нэр: Отгонхүү | |
хүйс: эрэгтэй | |
хаяг: БГД 2-5-4 тоот | |
# Өгөгдөл 2 | |
нэр: Номин | |
хүйс: эмэгтэй |
> db.system.js.save({_id:"last_n_users", value: function(n){return db.users.find().sort({created_at:-1}).limit(n).toArray()}}) | |
> db.eval("last_n_users(3)") | |
[ | |
{ | |
"_id" : ObjectId("4e8c2a00de570598c220878b"), | |
"username" : "Zoloo", | |
"created_at" : ISODate("2011-10-04T16:00:00Z"), | |
"password" : "secret", | |
"last_visited_at" : ISODate("2011-10-04T16:00:00Z") | |
}, |