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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:02:21+00:00 2026-06-17T08:02:21+00:00

I have data in my controller that is being received from another rails app

  • 0

I have data in my controller that is being received from another rails app and database (this has to be in the controller) I want to get this data so I can validate it in my model before allowing another step in a wizard (see my other question for some code examples)

My Problem is that I cannot directly grab this data from the controller in my model as this violates MVC.

My Question is how would I go about checking the controllers data in my Model?

  • Do I have to load this data / true – false response in a view and then link this to my Model? (I don’t really want this to show in the view and haven’t quite worked out how to do this)

  • Do I need to pass this data to a route i.e example/data.json and then check this in my Model? (I also haven’t worked out how to use this data.json from there in my model)

Any help / steering in the right direction would be very useful. (also i cannot use a gem to do this)

  • 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-06-17T08:02:22+00:00Added an answer on June 17, 2026 at 8:02 am

    At first, please be double double sure that you don’t validate a model by data which it does not contain by itself. Model should validate its current state but not a way it came to this state (e.g. which user put a model to this state).

    At second, you should never use controller methods in a model. If controller contains some business logic, extract that logic into a third class which will be used by both controller and model.

    Moreover, you have a data in a controller and you have an access to the model, right?. Therefore, if you are in a controller method, for instance in a before filter or action, you could take that data and pass it to the model, like this:

    def controller method
      hey_model.is_this_correct?(data)
    end
    

    If you say that that data must be checked after controller has responded to a request (for example, at the next wizard step, i.e. at the next request), then you definitely must store that value somewhere between requests.

    This is the very point of stateless HTTP. No data is saved between requests until you explicitly do that. You could store your value in cookies or in database.

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

Sidebar

Related Questions

So I have some data that gets pulled from another rails app in a
I have some data that I want to store somewhere in my Rails app
In my iPhone app I have a UIViewController that has a UITableView and another
I have a MVC-app that has a controller with an action that is supposed
I have a controller that runs some calculation on data, and then I need
I have a controller that is called with AJAX (sends JSON data), so I
I have a view controller that gets presented modally and changes some data that
I'm trying to send data to the Controller from the View. I have a
I have a simple unsubscribe function in my Unsubscribed controller. if ($this->Unsubscribe->save($this->data['Unsubscribes'])) { //
I have data being refreshed in a modalViewController and when that data gets refreshed,

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.