- fixed the rails root to rails 2.0.2
- updated the rails root to rails 2 standards - added .autotest file to fix autotest - fixed bug in determining the resource path git-svn-id: https://svn.thoughtbot.com/plugins/shoulda/trunk@286 7bbfaf0e-4d1d-0410-9690-a8bb5f8ef2aa
This commit is contained in:
parent
91a3bb5e6a
commit
46f8ff2437
|
@ -0,0 +1,8 @@
|
|||
Autotest.add_hook :initialize do |at|
|
||||
at.add_mapping(%r{^test/rails_root/\w.*}) do
|
||||
at.files_matching(%r{^test/*/\w.*_test\.rb})
|
||||
end
|
||||
|
||||
at.add_exception(%r{.svn})
|
||||
at.add_exception(%r{.log$})
|
||||
end
|
|
@ -244,7 +244,7 @@ module ThoughtBot # :nodoc:
|
|||
@parent ||= []
|
||||
@parent = [@parent] unless @parent.is_a? Array
|
||||
|
||||
collection_helper = [@parent, @object.pluralize, 'url'].flatten.join('_')
|
||||
collection_helper = [@parent, @object.to_s.pluralize, 'url'].flatten.join('_')
|
||||
collection_args = @parent.map {|n| "@#{object}.#{n}"}.join(', ')
|
||||
@destroy.redirect ||= "#{collection_helper}(#{collection_args})"
|
||||
|
||||
|
|
|
@ -34,8 +34,8 @@ class PostsController < ApplicationController
|
|||
respond_to do |format|
|
||||
if @post.save
|
||||
flash[:notice] = 'Post was successfully created.'
|
||||
format.html { redirect_to post_url(@post.user, @post) }
|
||||
format.xml { head :created, :location => post_url(@post.user, @post) }
|
||||
format.html { redirect_to user_post_url(@post.user, @post) }
|
||||
format.xml { head :created, :location => user_post_url(@post.user, @post) }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.xml { render :xml => @post.errors.to_xml }
|
||||
|
@ -49,7 +49,7 @@ class PostsController < ApplicationController
|
|||
respond_to do |format|
|
||||
if @post.update_attributes(params[:post])
|
||||
flash[:notice] = 'Post was successfully updated.'
|
||||
format.html { redirect_to post_url(@post.user, @post) }
|
||||
format.html { redirect_to user_post_url(@post.user, @post) }
|
||||
format.xml { head :ok }
|
||||
else
|
||||
format.html { render :action => "edit" }
|
||||
|
@ -65,7 +65,7 @@ class PostsController < ApplicationController
|
|||
flash[:notice] = "Post was removed"
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to posts_url(@post.user) }
|
||||
format.html { redirect_to user_posts_url(@post.user) }
|
||||
format.xml { head :ok }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<%= error_messages_for :post %>
|
||||
|
||||
<% form_for(:post, :url => post_path(@post.user, @post), :html => { :method => :put }) do |f| %>
|
||||
<% form_for(:post, :url => user_post_path(@post.user, @post), :html => { :method => :put }) do |f| %>
|
||||
<p>
|
||||
<b>User</b><br />
|
||||
<%= f.text_field :user_id %>
|
||||
|
@ -23,5 +23,5 @@
|
|||
</p>
|
||||
<% end %>
|
||||
|
||||
<%= link_to 'Show', post_path(@post.user, @post) %> |
|
||||
<%= link_to 'Back', posts_path(@post.user) %>
|
||||
<%= link_to 'Show', user_post_path(@post.user, @post) %> |
|
||||
<%= link_to 'Back', user_posts_path(@post.user) %>
|
||||
|
|
|
@ -12,13 +12,14 @@
|
|||
<td><%=h post.user_id %></td>
|
||||
<td><%=h post.title %></td>
|
||||
<td><%=h post.body %></td>
|
||||
<td><%= link_to 'Show', post_path(post.user, post) %></td>
|
||||
<td><%= link_to 'Edit', edit_post_path(post.user, post) %></td>
|
||||
<td><%= link_to 'Destroy', post_path(post.user, post), :confirm => 'Are you sure?', :method => :delete %></td>
|
||||
<td><%= link_to 'Show', user_post_path(post.user, post) %></td>
|
||||
<td><%= link_to 'Edit', edit_user_post_path(post.user, post) %></td>
|
||||
<td><%= link_to 'Destroy', user_post_path(post.user, post), :confirm => 'Are you sure?',
|
||||
:method => :delete %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<br />
|
||||
|
||||
<%= link_to 'New post', new_post_path(post.user) %>
|
||||
<%= link_to 'New post', new_user_post_path(post.user) %>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<%= error_messages_for :post %>
|
||||
|
||||
<% form_for(:post, :url => posts_path(@user)) do |f| %>
|
||||
<% form_for(:post, :url => user_posts_path(@user)) do |f| %>
|
||||
<p>
|
||||
<b>User</b><br />
|
||||
<%= f.text_field :user_id %>
|
||||
|
@ -23,4 +23,4 @@
|
|||
</p>
|
||||
<% end %>
|
||||
|
||||
<%= link_to 'Back', posts_path(@user) %>
|
||||
<%= link_to 'Back', user_posts_path(@user) %>
|
||||
|
|
|
@ -14,5 +14,5 @@
|
|||
</p>
|
||||
|
||||
|
||||
<%= link_to 'Edit', edit_post_path(@post.user, @post) %> |
|
||||
<%= link_to 'Back', posts_path(@post.user) %>
|
||||
<%= link_to 'Edit', edit_user_post_path(@post.user, @post) %> |
|
||||
<%= link_to 'Back', user_posts_path(@post.user) %>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Specifies gem version of Rails to use when vendor/rails is not present
|
||||
old_verbose, $VERBOSE = $VERBOSE, nil
|
||||
RAILS_GEM_VERSION = '1.2.3'
|
||||
RAILS_GEM_VERSION = '2.0.2'
|
||||
$VERBOSE = old_verbose
|
||||
|
||||
require File.join(File.dirname(__FILE__), 'boot')
|
||||
|
@ -12,8 +12,7 @@ Rails::Initializer.run do |config|
|
|||
config.log_level = :debug
|
||||
config.cache_classes = false
|
||||
config.whiny_nils = true
|
||||
config.breakpoint_server = true
|
||||
config.load_paths << File.join(File.dirname(__FILE__), *%w{.. .. .. lib})
|
||||
# config.load_paths << File.join(File.dirname(__FILE__), *%w{.. .. .. lib})
|
||||
end
|
||||
|
||||
Dependencies.log_activity = true
|
||||
# Dependencies.log_activity = true
|
|
@ -1,5 +1,6 @@
|
|||
ActionController::Routing::Routes.draw do |map|
|
||||
map.resources :users do |user|
|
||||
user.resources :posts
|
||||
end
|
||||
|
||||
map.resources :posts
|
||||
map.resources :users, :has_many => :posts
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue