Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 4227

Show
Ignore:
Timestamp:
04/18/06 05:23:47 (2 years ago)
Author:
david
Message:

Simplest thing possible

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • applications/molecule/app/controllers/entries_controller.rb

    r4219 r4227  
    3030  end 
    3131   
     32  def feed 
     33    @entries = @workspace.entries.find(:all, :limit => 25) 
     34    render :layout => false 
     35  end 
     36   
    3237  private 
    3338    def set_workspace 
  • applications/molecule/app/models/entry.rb

    r4219 r4227  
    55    self[:summary].blank? ? content : self[:summary] 
    66  end 
     7   
     8  def to_atom(builder = Builder::XmlMarkup.new) 
     9    builder.entry do |entry| 
     10      entry.title(title) 
     11      entry.updated(updated_at.xmlschema) 
     12      entry.published(created_at.xmlschema) 
     13      entry.content(:type => "xhtml", "xml:lang" => "en") { entry.text! content } 
     14    end 
     15  end 
    716end 
  • applications/molecule/app/views/entries/_new.rhtml

    r4224 r4227  
    1 <% remote_form_for(:entry, :url => create_entity_url) do |e| %> 
     1<% remote_form_for(:entry, :url => { :action => "create" }) do |e| %> 
    22  <p> 
    33    <b>Title:</b><br /> 
  • applications/molecule/app/views/layouts/application.rhtml

    r4219 r4227  
    33  <title><%= @workspace.title %></title> 
    44  <%= javascript_include_tag :defaults %> 
     5  <%= auto_discovery_link_tag :atom, feed_url %> 
    56</head> 
    67 
  • applications/molecule/config/routes.rb

    r4219 r4227  
    33  map.resource :entry 
    44 
     5  map.feed 'index.atom', :controller => "entries", :action => "feed" 
     6 
    57  map.connect ':controller/:action/:id' 
    68end 
  • applications/molecule/test/fixtures/entries.yml

    r4219 r4227  
    66  summary: On the wonders of the world 
    77  created_at: 2006-04-15 14:15 
     8  updated_at: 2006-04-15 14:15 
    89 
    910good_morning: 
     
    1314  content: What a lovely morning 
    1415  created_at: 2006-04-15 14:30 
     16  updated_at: 2006-04-15 14:30