users_controller.rb
class UsersController < ApplicationController
def index
render_404
end
def show
@user = User.where(:username => params[:username])
render_404 if !@user
end
end
basically i want to get each user data based on their username because later i want to include one more table which has meta-data for each user but i keep getting the following error
undefined method `username' for #<ActiveRecord::Relation:0x007fb5dbc52ea0>
Extracted source (around line #1):
1: <%= @user.username %> profile page
@user = User.where(:username => params[:username]).firsttry this or@user = User.find_by_username(params[:username]).WherereturnsAR::Relation, not an ActiveRecord object.