Matt Elhotiby
Matt Elhotiby

Reputation: 44086

Where should I put this code?

i have this snippet that i want to access from a controller or a model but i dont know what file to put it in

def cost_to_f(string)
 string.gsub(/[\$,]/, '').to_f
end

I tried application controller and application helper and no luck on either

any suggestions

Upvotes: 1

Views: 94

Answers (1)

mark
mark

Reputation: 10574

Check out the discussion here.

Upvotes: 3

Related Questions