RS, IZ; All relevant controllers now create with user.post
This commit is contained in:
parent
9fe37b1d8c
commit
74691228d3
10 changed files with 21 additions and 21 deletions
|
|
@ -6,10 +6,9 @@ class AlbumsController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@album = Album.new(params[:album])
|
||||
@album.person = current_user
|
||||
@album = current_user.post(:album, params[:album])
|
||||
|
||||
if @album.save
|
||||
if @album.created_at
|
||||
flash[:notice] = "Successfully created album."
|
||||
redirect_to @album
|
||||
else
|
||||
|
|
@ -47,4 +46,5 @@ class AlbumsController < ApplicationController
|
|||
render :action => 'edit'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ class BlogsController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@blog = Blog.new(params[:blog])
|
||||
@blog.person = current_user
|
||||
if @blog.save
|
||||
@blog = current_user.post(:blog, params[:blog])
|
||||
|
||||
if @blog.created_at
|
||||
flash[:notice] = "Successfully created blog."
|
||||
redirect_to @blog
|
||||
else
|
||||
|
|
|
|||
|
|
@ -31,9 +31,9 @@ class BookmarksController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@bookmark = Bookmark.new(params[:bookmark])
|
||||
@bookmark.person = current_user
|
||||
if @bookmark.save
|
||||
@bookmark = current_user.post(:bookmark, params[:bookmark])
|
||||
|
||||
if @bookmark.created_at
|
||||
flash[:notice] = "Successfully created bookmark."
|
||||
redirect_to @bookmark
|
||||
else
|
||||
|
|
|
|||
|
|
@ -3,11 +3,9 @@ class PhotosController < ApplicationController
|
|||
|
||||
def create
|
||||
begin
|
||||
#puts params.inspect
|
||||
@photo = Photo.instantiate(params)
|
||||
@photo.person = current_user
|
||||
@photo = current_user.post(:photo, params)
|
||||
|
||||
if @photo.save
|
||||
if @photo.created_at
|
||||
flash[:notice] = "Successfully uploaded photo."
|
||||
redirect_to @photo.album
|
||||
else
|
||||
|
|
|
|||
|
|
@ -13,10 +13,9 @@ class StatusMessagesController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@status_message = StatusMessage.new(params[:status_message])
|
||||
@status_message.person = current_user
|
||||
@status_message = current_user.post(:status_message, params[:status_message])
|
||||
|
||||
if @status_message.save
|
||||
if @status_message.created_at
|
||||
flash[:notice] = "Successfully created status message."
|
||||
redirect_to status_messages_url
|
||||
else
|
||||
|
|
|
|||
|
|
@ -20,6 +20,10 @@ class Album
|
|||
after_save :notify_people
|
||||
before_destroy :propagate_retraction
|
||||
|
||||
def instantiate params
|
||||
self.create params
|
||||
end
|
||||
|
||||
def self.mine_or_friends(friend_param, current_user)
|
||||
if friend_param
|
||||
Album.where(:person_id.ne => current_user.id)
|
||||
|
|
|
|||
|
|
@ -173,9 +173,10 @@ form {
|
|||
color: black; }
|
||||
#user_name span {
|
||||
size: small;
|
||||
font-style: italic;
|
||||
font-weight: normal;
|
||||
color: #999999; }
|
||||
#user_name #latest_message_time {
|
||||
font-style: italic; }
|
||||
#user_name ul {
|
||||
display: inline;
|
||||
margin: 0;
|
||||
|
|
|
|||
|
|
@ -207,11 +207,11 @@ form
|
|||
|
||||
span
|
||||
:size small
|
||||
:font-style italic
|
||||
:font
|
||||
:weight normal
|
||||
:color #999
|
||||
|
||||
#latest_message_time
|
||||
:font-style italic
|
||||
ul
|
||||
:display inline
|
||||
:margin 0
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ describe Post do
|
|||
it "should associate the owner if none is present" do
|
||||
@post.person.should == User.owner
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe "newest" do
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ describe User do
|
|||
describe 'friend requesting' do
|
||||
before do
|
||||
@user = Factory.create(:user)
|
||||
|
||||
end
|
||||
|
||||
it "should be able to accept a pending friend request" do
|
||||
|
|
|
|||
Loading…
Reference in a new issue