Displaying 3 results from an estimated 3 matches for "foldercontroller".
2006 Feb 15
6
error_messages_for trouble
...ing wrong here?
#### Model ########################
class MyFolder < ActiveRecord::Base
  def validate
    # validation test
    if name == ''test''
      errors.add(:name, "Folder cannot be named test")
    end
  end
end
#### Controller ########################
class FolderController < ApplicationController
  def list
    @my_folder = MyFolder.new
  end
  def create_folder
    @my_folder = MyFolder.new(params[:folder])
    if @my_folder.save
      flash[:notice] = "Folder created sucessfully"
    else
      flash[:notice] = "Error creating folder"
    end...
2006 May 18
3
access to an ApplicationController property from a view
Hi there,
How is it possible to get access to an ApplicationController property 
from a view?
Consider this (simplified) situation:
class ApplicationController < ActionController::Base
   def folder_id
     @folder_id = params[:id]
     return @folder_id
   end
end
class FolderController < ApplicationController
   def show
     @folder = Folder.find_by_id(folder_id)
   end
end
So far, so good, BUT... when trying to access folder_id in the show-view 
like this <%= folder_id %>, I get an error (undefined local variable or 
method `folder_id''). Is this possible or d...
2006 Nov 06
21
acts_as_ferret and associations
I have the following models:
    class Book < ActiveRecord::Base
      acts_as_ferret
      belongs_to :author
    end
    class Author < ActiveRecord::Base
        has_many :books
    end
and in the controller:
  def search
    if params[:query]
      @query = params[:query]
      @total, @books = Book.full_text_search(@query, :page => 
(params[:page]||1))
      @pages =