Class: RailsAdminFeaturedContent::FeaturedContentController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- RailsAdminFeaturedContent::FeaturedContentController
- Defined in:
- app/controllers/rails_admin_featured_content/featured_content_controller.rb
Instance Method Summary collapse
Instance Method Details
#create_images ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/rails_admin_featured_content/featured_content_controller.rb', line 12 def create_images @featured_content = FeaturedContent.find(params[:id]) @image = @featured_content.featured_content_images.create(image: params[:featured_content_image]) if @image render json: find_image(@image.id) else render json: @image.errors end end |
#search_content ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'app/controllers/rails_admin_featured_content/featured_content_controller.rb', line 3 def search_content @content_builder = RailsAdminContentBuilder::ContentBuilder.order('date_publish desc').limit(10).search(params[:term]) if @content_builder render json: @content_builder.to_json(:include => { :content_builder_category => {:only => [:name, :slug]} }) else render json: @content_builder.errors end end |