# GET /artists/new.json
def new
@artist = Artist.new
+ @artist.supply_default
respond_to do |format|
format.html # new.html.erb
# GET /artists/1/edit
def edit
- @artist = Artist.find(params[:id])
+ @artist = Artist.edit(params[:id], @author)
end
# POST /artists
# POST /artists.json
def create
- @artist = Artist.new(params[:artist])
- @artist.author_id = @author.id
+ @artist = Artist.new()
+ @artist.supply_default
+ @artist.attributes = params[:artist]
+ @artist.overwrite @author
respond_to do |format|
if @artist.save
format.html { redirect_to @artist, notice: 'Artist was successfully created.' }
# PUT /artists/1
# PUT /artists/1.json
def update
- @artist = Artist.find(params[:id])
+ @artist = Artist.edit(params[:id], @author)
+ @artist.attributes = params[:artist]
+ @artist.overwrite @author
respond_to do |format|
- if @artist.update_attributes(params[:artist])
+ if @artist.save
format.html { redirect_to @artist, notice: 'Artist was successfully updated.' }
format.json { head :ok }
else
# DELETE /artists/1
# DELETE /artists/1.json
def destroy
- @artist = Artist.find(params[:id])
+ @artist = Artist.edit(params[:id], @author)
@artist.destroy
respond_to do |format|