Displaying 3 results from an estimated 3 matches for "current_admin".
2012 Sep 20
4
access controller's object attributes in view page
Hi,
I am new to ROR and learning it. In my controller I have an admins
record and I am passing that admin object to the admin''s view page to
get the name of the admin. But when I try to access the name it is
showing error as "undefined method `name'' for :current_admin:Symbol"..
Please help..
Please find my code below
Sessions Controller
def create
admin=Admin.find_by_email(params[:session][:email].downcase)
if admin && admin.authenticate(params[:session][:password])
redirect_to(admins_index_path(:current_admin=>admin))
end
end...
2010 Apr 20
5
Spring Cleaning
Right now in my view, I have a whole HUGE clump of
<% if current_user %> and then <% if current_admin %> and then <% if
current_teacher %> and then all that other stuff in my view.
I have a ginourmous chunk of if and else statements in my views... is
there a way to make it prettier? The if and else''s almost all have the
same functions, expect for some minor changes.
Like this-...
2013 Jun 22
4
ActiveRecord::Base.transaction - SystemStackError - stack level too deep:
...uot;controller"=>"resources"
}
**Controller**
def create
if current_teacher
@resource = ResourceObject.create_teacher_resource(params, current_teacher)
end
if current_student
@resource = ResourceObject.create_student_resource(params, current_student)
end
if current_admin
@resource = Resource.new(params[:resource])
end
respond_to do |format|
if @resource.success
format.html { redirect_to @resource, notice: ''Resource was successfully created.'' }
format.json { render json: @resource, status: :created, location: @resource }...