i have a problem in ruby on rails. I want to make current user's store id to be 0 when user accesses to /homepage/, and i want to make user's store id to be the input id in the url when user accesses to /homepage/:id/.
My code:
routes.rb:
match "/homepage" => "users#access", :as => "store"
match "/homepage/:id" => "users#homepage", :as => "store"
def access
@user = current_user
@user.update_attributes(:store => "0")
@user.save
end
def homepagestore
@user = current_user
@user.update_attribute(:id, user.store = :id)
@user.save
end