jkrejci
jkrejci

Reputation: 45

Parsing Input From User in text_field To Model, Then Display A View

Here are the exact steps I am trying to take in order to parse data from an API call:

User inputs zip code into text_field, hits submit_tag button Calls to wunderground API for hourly forecast Store data from API call to be parsed, maybe in an instance variable...? Depending on the parsed weather it will display one of two pages (Hot or Cold)

One problem, I either have no idea what I am doing here, or it is so trivial I am over complicating the entire process. (I tend to do that a lot)

What steps would you take in order to complete this task? I am completely lost and have scoured the internet trying to find an answer for the past week, please help? Thanks for looking!

Upvotes: 1

Views: 123

Answers (1)

Bhushan Lodha
Bhushan Lodha

Reputation: 6862

You can have something like this in model so you don't need to save it in database

class Foo << ActiveRecord::Base

  attr_accessor :zipcode
  attr_accessible :zipcode

 def process_zipcode
   ## make api call and get data
 end

end

here you don't need to save zipcode in database.

Upvotes: 2

Related Questions