Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7632309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:35:36+00:00 2026-05-31T06:35:36+00:00

I have a rails site and I would like to render the live site

  • 0

I have a rails site and I would like to render the live site through the dashboard. I have created a dashboard for the back end of the website but when a user makes a change I would like them to see it first.

Here’s my

Dashboard.rb

has_many :profiles, :dependent => :destroy

has_many :blogs, :through => :profile, :dependent => :destroy
has_many :videos, :through => :profile, :dependent => :destroy
has_many :albums, :through => :profile, :dependent => :destroy

Dashboard index.html

<%= render :partial => 'profiles/profile', :locals => {:profile => @profile} %>

Profile.rb

belongs_to :dashboard
has_many :blogs, :dependent => :destroy
has_many :videos, :dependent => :destroy
has_many :albums, :dependent => :destroy

_profile.html.erb

<h1><%= @profile.name %></h1>

<% album = @profile.albums.last %>
<% if album.blank? %>
<%= link_to 'Create a new album', new_album_path %></br>
<% else %>
<%= render :partial => 'albums/album', :locals => {:album => @profile.albums.last} %>   
<% end %>

<% blog = @profile.blogs.last %>
<% if blog.blank? %>
<%= link_to 'Create a blog post', new_blog_path %><br/>
<% else %>
<%= render :partial => 'blogs/blog', :locals => {:blog => @profile.blogs.last}%>
<% end %>

<% video = @profile.videos.last %>
<% if video.blank? %>
<%= link_to 'Add new video', new_video_path %></br>
<% else %>
<%= render :partial => 'videos/video', :locals => {:video => @profile.videos.last} %>
<% end %>

The above works fine when I’m viewing the site through the frontend but when trying to view it through the dashboard I get the error

undefined method `name’ for nil:NilClass

Which is the profile.name line

If I delete the line above I get the

undefined method `shows’ for nil:NilClass

Anyone have any suggestions how I can solve this issue?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T06:35:37+00:00Added an answer on May 31, 2026 at 6:35 am

    There needs to be @profile find inside controller. If the params id is not valid then it will redirect to root url and if valid it will render page.

    def index
      @profile = Profile.find_by_id(params[:id])
      @profile || invalid_url!
    end
    
    private
    def invalid_url!
      flash[:error] = 'URL is not valid !'
      redirect_to root_url
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to allow users of my website see a special Image/Video/HTML but
I am developing a site using Ruby on Rails. I would like to develop
I would like to crawl a popular site (say Quora) that doesn't have an
I'm creating a site using a small Ruby framework, Sinatra, but I would like
We have a site that we would like our customers to embed in their
I am working on a rails application and I have a Dashboard::user(dashboard/user) controller and
I have a Rails 2.1.2 site that only has html templates e.g. jobs.html.erb, so
I have a Rails app hosted in Heroku. If I go the the site
I am going to be deploying a site i have built in rails 3
I have a site built in Ruby On Rails which has many ads in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.