Module: CatForms::Form::InstanceMethods
- Defined in:
- lib/cat_forms.rb
Instance Method Summary collapse
- #initialize(options = {}) ⇒ Object
-
#persisted? ⇒ Boolean
Need to look into all the below methods, not sure if they are correct.
- #save ⇒ Object
- #save_to_storage! ⇒ Object
- #storage_options ⇒ Object
- #to_key ⇒ Object
- #to_model ⇒ Object
- #to_param ⇒ Object
- #to_partial_path ⇒ Object
Instance Method Details
#initialize(options = {}) ⇒ Object
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
# File 'lib/cat_forms.rb', line 210 def initialize = {} run_callbacks(:initialize) do # can sometimes be a string if .class != Hash = {} end [:form] ||= {} # TODO fix # This allows setting of custom things .each do |key, value| instance_variable_set "@#{key}", value end CatForms::GzipCookie.load().each do |key, value| method = "#{key}=" if respond_to?(method) self.send method, value end end [:form].each do |name, value| value.strip! if value.respond_to?(:strip) self.send "#{name}=", value end end super end |
#persisted? ⇒ Boolean
Need to look into all the below methods, not sure if they are correct.
181 182 183 |
# File 'lib/cat_forms.rb', line 181 def persisted? false end |
#save ⇒ Object
201 202 203 204 205 206 207 208 |
# File 'lib/cat_forms.rb', line 201 def save run_callbacks :save do if !valid? return false end end self end |
#save_to_storage! ⇒ Object
240 241 242 243 |
# File 'lib/cat_forms.rb', line 240 def save_to_storage! = .merge(attributes: attributes) CatForms::GzipCookie.save() end |
#storage_options ⇒ Object
245 246 247 248 249 250 251 |
# File 'lib/cat_forms.rb', line 245 def { cookie_name: @cookie_name, request: @request, response: @response } end |
#to_key ⇒ Object
197 198 199 |
# File 'lib/cat_forms.rb', line 197 def to_key nil end |
#to_model ⇒ Object
185 186 187 |
# File 'lib/cat_forms.rb', line 185 def to_model self end |
#to_param ⇒ Object
193 194 195 |
# File 'lib/cat_forms.rb', line 193 def to_param nil end |
#to_partial_path ⇒ Object
189 190 191 |
# File 'lib/cat_forms.rb', line 189 def to_partial_path "some_path" # TODO figure out what's needed here for Rails 3.2 end |