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 7653087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:56:13+00:00 2026-05-31T11:56:13+00:00

https://github.com/rails-sqlserver/activerecord-sqlserver-adapter Awesome tool, I plugged into a SQLServer 2008 with little trouble and figure

  • 0

https://github.com/rails-sqlserver/activerecord-sqlserver-adapter

Awesome tool, I plugged into a SQLServer 2008 with little trouble and
figure out how to execute a SP from rails console, but I don’t know where
to go from here 🙁

This seems like a silly question to ask, but I’m pretty new to
development so any help would be greatly appreciated!!

Here’s how I ran the SP (PD_DE_getSegmentProfile) from console:

$ PdDeSegmentMaster.execute_procedure :PD_DE_getSegmentProfile, 23, 'all' 

Execute Procedure (49.6ms)  EXEC PD_DE_getSegmentProfile 23, 'all' 
 => [{"segment_code"=>"23", "profile_element"=>"age_range", 
"Value"=>"35-54"}, {"segment_code"=>"23", 
"profile_element"=>"avg_HH_size", "Value"=>"4.10"} 

I know that’s a hash, but I’ve no idea how to call it from my app,
display it in a view, et cetera. I’m not really concerned with storing
it since I can just recall the SP to get it again. Where do I put the
SP call in the app? Controller? Model?

database.yml, externaldb.rb (model) and the basics needed to set up the connection are all good, just need to move the returned hash to the HTML.

  • 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-31T11:56:15+00:00Added an answer on May 31, 2026 at 11:56 am

    Its best to move business logic to model.

    Lets us say you are using the controller “PdDeSegmentMastersController”

    class PdDeSegmentMasterController < ActionController
      def get_segment_profile
        @segment_profiles = PdDeSegmentMaster.get_segment_profile
      end 
    end
    

    In your model “PdDeSegmentMaster”

    class PdDeSegmentMaster < ActiveRecord::Base
     #write a method to execute you stored procedure
      def self.get_segment_profile
        self.execute_procedure :PD_DE_getSegmentProfile, 23, 'all'
      end
    end
    

    In your view “get_segment_profile.html.erb”

    <% if @segment_profiles.present? %>
    <table>
     <tr>
       <th>segment_code</th>
       <th>profile_element</th>
       <th>Value</th>
     </tr>
     <% @segment_profiles.each do | segment_profile| %>
       <tr>
        <td><%= segment_profile["segment_code"] %></td>
        <td><%= segment_profile["profile_element"] %></td>
        <td><%= segment_profile["Value"] %></td>
       </tr>
     <% end %>
    </table> 
    <% else %>
     <h1>No segment profiles found!</h1>
    <% end %>
    

    Let me know if you still have any blocks.

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

Sidebar

Related Questions

I'm trying to implement the rails-settings gem (https://github.com/100hz/rails-settings) into my Rails 3 project using
I'm using rails-settings by Squeegy from https://github.com/Squeegy/rails-settings as well as Activeadmin . What I'm
I am trying to create a chat application on heroku using the following https://github.com/tarnfeld/PusherChat-Rails
I'm using clearance ( https://github.com/thoughtbot/clearance/wiki ) for authentication in my rails app. But I'm
I am using successfully the mobylette rails gem: https://github.com/tscolari/mobylette I was wondering if anybody
My environment is rails 3.1, heroku bamboo stack, delayed_job_active_record, (https://github.com/collectiveidea/delayed_job ) and experimenting with
I'm using gem rapns (https://github.com/ileitch/rapns) on my rails app. According to rapns doc, I
I have been using the less-rails-bootstrap gem from https://github.com/metaskills/less-rails-bootstrap in my rails 3.1 project.
I'm using Rails 3.1 and the paypal_adaptive ( https://github.com/tc/paypal_adaptive ) gem in order to
I want to use LiveFilter https://github.com/mikemerritt/LiveFilter in my rails app. It does exactly what

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.