scinote-web/app/controllers/sample_my_modules_controller.rb

29 lines
541 B
Ruby
Raw Normal View History

2016-02-12 23:52:43 +08:00
class SampleMyModulesController < ApplicationController
before_action :load_vars
def index
@number_of_samples = @my_module.number_of_samples
@samples = @my_module.first_n_samples(5)
respond_to do |format|
format.json {
render :json => {
:html => render_to_string({
:partial => "index.html.erb"
})
}
}
end
end
private
def load_vars
@my_module = MyModule.find_by_id(params[:my_module_id])
unless @my_module
render_404
end
end
end