How do I block another user in Rails?
I have a User model that has_many Venues and I'd like to allow users to
block venues so they won't see it in the default venue list (which shows
everything).
I'm looking through documents/tutorials now before I start writing code,
but I thought I'd ask here to get any advice or suggestions. Once I have
the relationship working I'll post the code so anyone else working on
something similar can see it.
Currently the two models look like this:
class User < ActiveRecord::Base
attr_accessible :name, :email, :password, :password_confirmation,
:remember_me
has_many :venues, :dependent => :destroy
end
class Venue < ActiveRecord::Base
attr_accessible :name, :address
belongs_to :user
end
And the Venues Controller:
class VenuesController < ApplicationController
def index
@venues = Venue.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @venues }
end
end
end
No comments:
Post a Comment