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

  • Home
  • SEARCH
  • 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 6365205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:15:51+00:00 2026-05-25T00:15:51+00:00

Beginner rails/javascript question: Let’s say that I have a simple Circle model in a

  • 0

Beginner rails/javascript question:

Let’s say that I have a simple Circle model in a Rails 3.1 app with a show action/view. Each Circle has a property called :radius – an integer value.

When I view the Circle via its show.html.erb file, I want a very simple processing.js sketch to receive the radius of the circle and draw the circle on the page. I’ve already included processing.js in my app by saving the file in the assets/javascripts folder.

My simple processing.js sketch is in a file called circle.js. Its contents are:

// Setup the Processing Canvas  
void setup(){  
  size( 200, 200 );  
  strokeWeight( 10 );  
  frameRate( 15 );  
  X = width / 2;  
  Y = height / 2;
  radius = 10;      
}  

// Main draw loop  
void draw(){    
  // Fill canvas grey  
  background( 100 );  

  // Set stroke-color white  
  stroke(255);   

  // Draw circle  
  ellipse( X, Y, radius, radius );                    
}  
  1. How do I include the sketch into my show view as unobtrusively as possible and pass the radius value to it?
  2. Where does the circle.js file go — in the view folder or in the asset pipeline?
  3. Does it need to be named circle.js.erb?
  • 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-25T00:15:52+00:00Added an answer on May 25, 2026 at 12:15 am

    You can put circle.js into app/assets/javascripts. It doesn’t need to be called circle.js.erb, but it could be.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Iam a beginner in rails 3. I want to create a simple App. In
Here's a beginner rails question... After I do: format.xml { head: ok} How do
I'm a beginner at rails programming, attempting to show many images on a page.
I am a beginner in Rails and I read that the Rails enforces the
I'm trying to create a rails web app that does not use ActiveRecord framework
Brief question, beginner's work on Ruby/Rails. Here's my view: <h1>News</h1> <%= @posts.each do |post|
I am a beginner Ruby on Rails developer. So far I have created several
very beginner question. I am using Rails 3's query interface as shown: class User
Hi im quite beginner in rails. i have a problem suggestion will be appreciated.
I'm somewhat of a Rails beginner, and can't shake the feeling that I'm overlooking

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.