towsta 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module Towsta
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -23,6 +23,7 @@ module Towsta
23
23
  eval "def #{attr}; #{Vertical.parse_get attr, kind}; end;"
24
24
  eval "def self.find_by_#{attr} value; #{Vertical.parse_find attr, kind}; nil; end;"
25
25
  eval "def self.find_all_by_#{attr} value; #{Vertical.parse_find_all attr, kind}; end;"
26
+ eval "def option_for_#{attr} value; return {value: value, selected: 'selected'} if value == #{attr}; {value: value}; end"
26
27
  end
27
28
 
28
29
  def self.first
@@ -42,8 +43,9 @@ module Towsta
42
43
  self.class.all << self
43
44
  end
44
45
 
45
- def update args
46
+ def update args, author=$towsta_default_author
46
47
  args.each {|k,v| eval "self.#{k}= '#{v}';"}
48
+ self.save author
47
49
  end
48
50
 
49
51
  def self.update args
data/lib/towsta.rb CHANGED
@@ -12,6 +12,9 @@ def sync_with_towsta params=nil
12
12
  params = $towsta_sync.merge(params) if params
13
13
  return Towsta::Memory.recover params if $towsta_cache
14
14
  Towsta::Synchronizer.new :secret => $towsta_secret, :path => $towsta_path, :params => params
15
+ begin
16
+ Dir["./models/*.rb"].each {|file| load file }
17
+ rescue; end;
15
18
  end
16
19
 
17
20
  def clear_sync
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 0
9
- version: 1.0.0
8
+ - 1
9
+ version: 1.0.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Mortaro
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-10-28 00:00:00 -02:00
17
+ date: 2011-10-31 00:00:00 -02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency