Class PermalinksController
In: app/controllers/permalinks_controller.rb
Parent: ApplicationController

Methods

create   destroy   edit   index   new   show   update  

Public Instance methods

[Source]

    # File app/controllers/permalinks_controller.rb, line 28
28:   def create
29:     @permalink = Permalink.new(params[:permalink])
30:     if @permalink.save
31:       flash[:notice] = "Successfully created permalink."
32:       redirect_to @permalink
33:     else
34:       render :action => 'new'
35:     end
36:   end

[Source]

    # File app/controllers/permalinks_controller.rb, line 52
52:   def destroy
53:     @permalink = Permalink.find(params[:id])
54:     linkable = @permalink.linkable
55: 
56:     @permalink.destroy
57:     flash[:notice] = "Successfully destroyed permalink."
58:     redirect_to :controller => linkable.class.to_s.downcase.pluralize, :action => :edit, :id => linkable
59:   end

[Source]

    # File app/controllers/permalinks_controller.rb, line 38
38:   def edit
39:     @permalink = Permalink.find(params[:id])
40:   end

[Source]

   # File app/controllers/permalinks_controller.rb, line 5
5:   def index
6:     @permalinks = Permalink.all
7:   end

[Source]

    # File app/controllers/permalinks_controller.rb, line 24
24:   def new
25:     @permalink = Permalink.new
26:   end

[Source]

    # File app/controllers/permalinks_controller.rb, line 9
 9:   def show
10:     if params[:path]
11:       params[:id] = params[:path].first
12:       flash[:error] = '404 * ' + t(:requesterd_url_not_found, :url => params[:path])
13:     end
14:     @permalink = Permalink.find_by_url(params[:id])
15:     if @permalink
16:       redirect_to :controller => @permalink.linkable.class.to_s.downcase.pluralize,
17:                   :action => 'show',
18:                   :id => @permalink.url
19:     else
20:       redirect_to root_path
21:     end
22:   end

[Source]

    # File app/controllers/permalinks_controller.rb, line 42
42:   def update
43:     @permalink = Permalink.find(params[:id])
44:     if @permalink.update_attributes(params[:permalink])
45:       flash[:notice] = "Successfully updated permalink."
46:       redirect_to @permalink
47:     else
48:       render :action => 'edit'
49:     end
50:   end

[Validate]