voltrb / volt Goto Github PK
View Code? Open in Web Editor NEWA Ruby web framework where your Ruby runs on both server and client
License: MIT License
A Ruby web framework where your Ruby runs on both server and client
License: MIT License
After cloning the todo demo app, bundle install gives this error message:
Could not find regin-0.3.8 in any of the sources
Regin is yanked, but older version of regin is still available from rubygems.org. It's not a problem with jruby, only in MRI. I don't know which version.
If you skip bundle install and simply does gem install manually for all the gems in the Gemfile, you still get this error while running volt server:
Could not find websocket-driver-0.3.2 in any of the sources
The Volt server command currently does not take a pid option. Thin, however, has a default pid file at tmp/pids/thin.pid. This file gets destroyed when Volt rm-rf's the tmp dir on boot.
Volt needs to either ignore the tmp dir or take a pid option - or both.
It's fantastic that puts statements in the controllers are converted to javascript and the output ends up in the browsers javascript console. But how do I debug this?
In rails and sinatra I use pry a lot, and in the browser I use the javascript console just as much. In meteor you have direct access to the server from the browsers javascript console.
The best solution would probably be a pry like shell running in the browser like http://tryruby.org/ in dev mode, where you could type in ruby statements. This feature would probably take just as much time to implement as the rest of volt combined, but it's hard to code without other tools than debug print.
Gems like Capistrano and Whenever use the /config directory for their configuration files, but volt attempts to load those files at runtime. This can result in errors.
I looked at the rails code to see how they treat /config, and it appears that they only load the specific filenames associated with rails, ignoring the rest of the files in /config.
So far, it seems like /config/app.rb is the only file that needs to be loaded here: https://github.com/voltrb/volt/blob/master/lib/volt/config.rb#L67
Perhaps a hard-coded array of volt-specific config files could be fed into the .each method? I would be happy to submit a PR that fits your design decision.
Volt looks amazing and I cannot wait to try it out, but there is at least one thing missing for me: One or more alternative template languages that are less verbose than html.
I know Haml is not for everyone and I would not expect it to be the default, but after 15+ years of web development, I really enjoy anything that saves me time writing my html templates.
It need not be Haml. Slim is nice as well. Or something else entirely that is in the spirit of the two.
At the very least it would be wonderful to have a well-defined interface to plug-in alternative templating engines.
Sorry if this has been asked before. And of course this not a big showstopper. Still, I would love to hear your thoughts about this.
https://github.com/stiller/volt#automatic-model-conversion
This no longer seems to work:
[2] volt(#<Page>)> user = Model.new
=> <Model:70334659638700 {}>
[3] volt(#<Page>)> user._name = 'Ryan'
=> "Ryan"
[4] volt(#<Page>)> user._profiles = {
[4] volt(#<Page>)* twitter: 'http://www.twitter.com/ryanstout',
[4] volt(#<Page>)* dribbble: 'http://dribbble.com/ryanstout'
[4] volt(#<Page>)* }
=> {:twitter=>"http://www.twitter.com/ryanstout",
:dribbble=>"http://dribbble.com/ryanstout"}
[5] volt(#<Page>)> user._name
=> "Ryan"
[6] volt(#<Page>)> user._profiles._twitter
=> <Model:70334660046800 nil>
bundle exec volt server
Volt 0.8.26
Using rack adapter
/Users/ypcat/.rvm/gems/ruby-2.1.3@volt/gems/volt-0.8.26/lib/volt/server/rack/asset_files.rb:38:in `component': Unable to find component 'rspec-builder.rb', make sure the gem is included in your Gemfile (RuntimeError)
{#if _collection.any?}{#each _collection as c}{c.name}{/}{/} will cause the first item to be output twice, once at the beginning and once at the end. The same thing happens with .empty?, but does not happen with .size == 0.
You can test this by editing app/main/views/blog/edit.html in the todos3 app and wrapping the {#each _posts as post}{/} block with a {#if _posts.any?}{/} conditional.
Need to add a database.yml or something similar.
(I'm not sure if there's already a way to do this but I didn't find anything in the docs or on stackoverflow)
Is there a way to force an action (or a part of it) to be handled on the server? Examples why this might be necessary include:
Specifically I'm writing a media player application that needs to audio files in a folder and send commands to the mplayer-ruby
gem (which in turn talks to an mplayer
process)
Hello World
The problem is important in web development. This is my summary for more than 15 years of my experience on the web development: from ASP, PHP4, plain HTML, CSS without firebug, more than 5 years with Drupal, this is a great and complex CMS/Framework, now learning in Ruby and C.
This is not about blah-blah TODO.app on pure JS and fresh RIA (from Flash), or generation a flat single-page of html application with super-smart JS tools, that be a very good in maintainable. Analogs all of this I had ten years ago, with opacity - oh this buzzwords :)
NEED modern the framework, that need for each Web Developer, in the Ruby Community.
I hope you have a minute to consider a idea, goals and problems:
https://github.com/alexsun/Flower-Power/blob/master/README.md
This description draft, not structured. Meager English, with interpreter; (maybe later I will find time for study English grammar, forgive me)
plan in few days (weeks) add description, structure of goals and beautify with dummy examples of usage
I'm not want forking, pull two frameworks and do all in a solo, maybe have more better way?
any comments, critics, help, very welcome
How about adopting something like this for the changelog?
Seems way more informative to me.
Volt looks really awesome, but so far I've not been able to see the ruby code for my controller in chrome debugger. I ran the app with MAPS=true turned on and while I see an opal_source_maps that contains Opal stdlib source I don't see the sourcemaps for my volt controller, for example, just one big main.js file. Am I missing something? Are other people getting this to work?
The app gets notified when a file in `app//tasks' changes but the file is not actually reloaded on the server side. An overview of reloading techniques can be found at http://rkh.im/code-reloading
Is there any way to change default db name ?
I want to use an existing mongo database with few collections.
Hi, I was trying to deploy volt in Amazon's Elastic Beanstalk with puma and nginx, but it seems like that the base assets from volt where missing.
Am I doing something wrong?
Thanks
Being able to see the communication between volt and mongo directly in the log would be pretty useful during development.
It would be great if you have some documentation for the deployment steps in heroku as well as in own server.
I tried asking the following question on StackOverflow with the voltrb
tag, but like the title says, it needs to be created by someone with 1500 reputation. Could someone with enough rep create it or can you change the README to suggest some other tag?
Here's my question if you'd like to ask it as part of creating the tag (or feel free to answer it here):
I've got a use case where I'd like to POST some data to my Volt app, but there doesn't seem to be an obvious way to do it. app/main/config/routes.rb
doesn't recognize a post
method like a Sinatra route.
I also tried a Volt-external class tied into the app via config.ru
, and I can POST my data to the same Mongo collection that Volt is using. But that data is not reflected in the app until I refresh the page, which is less than ideal. I was hoping my reactive models would see the change in the DB and reflect that on the frontend.
I understand that Volt is in beta, so this feature may not be implemented yet (or even planned for the future). Is it possible to do this?
Running on Windows 8.1:
> volt new volt_project
Volt 0.7.18
create volt_project
create volt_project/.gitignore
create volt_project/Gemfile
create volt_project/README.md
create volt_project/app
create volt_project/app/main/assets/css
create volt_project/app/main/assets/js
create volt_project/app/main/config/dependencies.rb
create volt_project/app/main/config/routes.rb
create volt_project/app/main/controllers/main_controller.rb
create volt_project/app/main/models
create volt_project/app/main/views/main/about.html
create volt_project/app/main/views/main/index.html
create volt_project/app/main/views/main/main.html
create volt_project/config.ru
create volt_project/lib
create volt_project/public/index.html
create volt_project/spec/spec_helper.rb
Bundling Gems....
The system cannot find the path specified.
First off, awesome project!
Question.....seeming as you guys are using cutting edge stuff, have you checked out rethinkdb.com as an alternative to mongodb?
Where are run the specs the opal portion just hangs forever:
~/p/volt git:master ❯❯❯ bundle exec rake
--------------------------
Run specs in Opal
--------------------------
Thin web server (v1.6.3 codename Protein Powder)
Maximum connections set to 1024
Listening on 0.0.0.0:9999, CTRL+C to stop
TypeError: undefined is not an object (evaluating 'args[0]')
/Users/bozhidar/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/opal-rspec-0.4.0/vendor/spec_runner.js:17 in global code
No idea where this type error originates from.
Ruby 2.1.5, OS X Yosemite, phantomjs 2.0
This is just a tracking issue for the docs and changes to framework that make it simpler to manage the DOM manually in Volt. @ryanstout is already working on this. The changes (and documentation) will make it simpler to use things like external JS libraries that are not included in Opal/Volt by default (e.g. JQuery UI).
If you are in volt console and you execute the following code from the docs:
store._states << {name: 'Montana'}
montana = store._states[0]
montana._cities << {name: 'Bozeman'}
montana._cities << {name: 'Helena'}
store._states << {name: 'Idaho'}
idaho = store._states[1]
idaho._cities << {name: 'Boise'}
idaho._cities << {name: 'Twin Falls'}
store._states
_cities
does not persist
I gave Volt a spin for the first time last night, and I really like what I see so far. I come from a Rails background and consider myself more of a "get it done" app developer with more experience on the front-end (which can be good and bad).
One thing I love about Rails is ActiveRecord. It's a thing of beauty. What's the ORM plan for Volt in handling relational models?
I get this error when installing the gem volt:
"rake's executable "rake" conflicts with /Users/workstation1/.rbenv/versions/2.2.0/bin/rake
Overwrite the executable? yN"
I am fairly new to Rails but didn't expect this and haven't seen this issue with other gems I've installed.
Thank you.
I'm unable to start the volt server due to an error:
$ thin start
Using rack adapter
c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/volt-0.7.18/lib/volt/server
.rb:7:in `require': cannot load such file -- thin (LoadError)
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/volt-0.7.18/li
b/volt/server.rb:7:in `<top (required)>'
from c:/Users/raino_000/Documents/Workspaces/Ruby/volttest/config.ru:3:i
n `require'
from c:/Users/raino_000/Documents/Workspaces/Ruby/volttest/config.ru:3:i
n `block in <main>'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib
/rack/builder.rb:55:in `instance_eval'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib
/rack/builder.rb:55:in `initialize'
from c:/Users/raino_000/Documents/Workspaces/Ruby/volttest/config.ru:1:i
n `new'
from c:/Users/raino_000/Documents/Workspaces/Ruby/volttest/config.ru:1:i
n `<main>'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thin-1.6.2/lib
/rack/adapter/loader.rb:33:in `eval'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thin-1.6.2/lib
/rack/adapter/loader.rb:33:in `load'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thin-1.6.2/lib
/rack/adapter/loader.rb:42:in `for'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thin-1.6.2/lib
/thin/controllers/controller.rb:170:in `load_adapter'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thin-1.6.2/lib
/thin/controllers/controller.rb:74:in `start'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thin-1.6.2/lib
/thin/runner.rb:199:in `run_command'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thin-1.6.2/lib
/thin/runner.rb:155:in `run!'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thin-1.6.2/bin
/thin:6:in `<top (required)>'
from c:/RailsInstaller/Ruby1.9.3/bin/thin:23:in `load'
from c:/RailsInstaller/Ruby1.9.3/bin/thin:23:in `<main>'
Seems that most of the contens are the same, why not depending on opal-AS?
I've noticed that if you move the main "/" route to the top of the routes file, for example on https://github.com/voltrb/todos3/blob/master/app/main/config/routes.rb leaving it like this,
# The main route
get '/'
get "/todos/{_index}", _action: 'todos'
get "/todos", _action: 'todos'
get "/meal_cost", _action: 'meal_cost'
get "/about", _action: 'about'
get "/collections/{_route}", _action: 'collections'
get "/collections", _action: 'collections'
get "/blog/{_id}/edit", _controller: 'blog', _action: 'edit'
get "/blog/{_id}", _controller: 'blog', _action: 'show'
get "/blog", _controller: 'blog', _action: 'index'
get "/blog/new", _controller: 'blog', _action: 'new'
it affects the URLs so, although the app still works, you get ugly URLs like:
http://localhost:3000/?controller=blog&action=index#
instead of
http://localhost:3000/blog
I think your framework is awesome, I love the idea of being able to use ruby on the front end and on the back end is amazing and will be a help to learning front end oriented frame works.
That said, I have to ask, how do you integrate things that need javascript, I.e google maps or a java script video player.
Using ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
Here, store._foos.to_a
works because we load store._foos
on the line immediately before, when we push to it.
➜ bundle exec volt c
Volt 0.8.26
[1] volt(#<Volt::Page>)> store._foos
=> #<Volt::ArrayModel:12855100 []>
[2] volt(#<Volt::Page>)> store._foos << {bar: 'foo'}
=> #<Promise(12092500): nil>
[3] volt(#<Volt::Page>)> store._foos.to_a
=> [{:bar=>"foo", :_id=>"1b10518d779c8d912cb0140c"}]
[4] volt(#<Volt::Page>)> store._foos
=> #<Volt::ArrayModel:12855100 [<Volt::Model:12098340 {:bar=>"foo", :_id=>"1b10518d779c8d912cb0140c"}>]>
[5] volt(#<Volt::Page>)> exit
However, in this new console session, it returns an empty array until we call store._foos
by itself for the first time.
➜ bundle exec volt c
Volt 0.8.26
[1] volt(#<Volt::Page>)> store._foos.to_a
=> []
[2] volt(#<Volt::Page>)> store._foos.to_a
=> []
[3] volt(#<Volt::Page>)> store._foos
=> #<Volt::ArrayModel:16145800 [<Volt::Model:14582000 {:_id=>"1b10518d779c8d912cb0140c", :bar=>"foo"}>]>
[4] volt(#<Volt::Page>)> store._foos.to_a
=> [{:_id=>"1b10518d779c8d912cb0140c", :bar=>"foo"}]
Just a reminder, I'll probably create a pull request tomorrow.
Where is this code located and how can I modify it? I want to be able to add login/logout links and access the current users username/email for use in my view files. Any help is greatly appreciated. Thank you for your time.
Resource interpreted as Script but transferred with MIME type text/html: "http://localhost:3000/components/main.js
I'm a little confused on why this is happening... A very specific scenario is producing an error that can be avoided by renaming a model or collection, or removing a method.
Every time I click submit to save the model, I get this error:
[ERROR] wrong number of arguments (2 for 0) (ArgumentError)
The stack trace is pointing me at the initialize method in the tweet class:
class Tweet < Volt::Model
field :from, String
field :to, String
def initialize
super
self.from = ''
self.to = ''
end
end
If I get rid of the initialize method, everything saves correctly but in the view my Tweet
attributes each show up as a Volt::Model
. Here is the controller for reference:
class MainController < Volt::ModelController
model :store
def index
new_tweet
end
def tweet
page._tweet
end
def new_tweet
page._tweet = Tweet.new
end
def submit
store._tweets << tweet
new_tweet
end
end
I'd love to know what I should be doing differently to properly make those attributes default to empty strings, and how to override initialize without issues, however that's not the issue I want to bring attention to.
The strangest part of this that doesn't make any sense to me is that if I rename store._tweets
to store._tweats
or store._items
(really anything else). There are no errors - everything saves as expected even with initialize still in there. Alternatively, I can rename the Tweet
model to Tweat
and once again everything works.
If I remove the override to initialize
OR rename either the model or collection name - there are no issues. What could be causing this deadly combination? Any idea what the connection is?
Volt should be backend agnostic? Shouldn't mongo be added to new project's Gemfile
s instead?
~> X.Y.Z
dependencies lock versions to X.Y.*
. Better to use ~> X.Y
to allow newer versions.
If you are in volt console and you execute the following code from the docs:
store._states << {name: 'Montana'}
montana = store._states[0]
montana._cities << {name: 'Helena'}
montana._capital = montana._cities.last
_capital
does not persist
Hi,
On the Volt homepage (http://voltframework.com/), there is an example of "Attribute Bindings" (http://docs.voltframework.com/en/docs/attribute_bindings.html) that seems to place the contents of an input tag into a separate part of the page (that updates as the text in the field is changed). It appears that this functionality does not securely update the DOM when copying the value of the input tag into the thing it is bound to. At the bottom of however the update is implemented it is likely doing an assignment to the innerHTML
of the bound element. Due to this, it is possible to inject HTML into the page by typing (/pasting/dragging/etc) text containing HTML into the field (or potentially anything using this type of functionality). This should be modified (if it is doing something simple like that) to instead assign to innerText
so that the content gets escaped by the browser when set.
For example, the below text can be copied into such a field, and the page will inject the img
tag and execute the content of the onerror
attribute.
Hello<img src="fail" onerror="alert('Hello World!!')"/> World!
Here is the code for my dynamically generated panels:
<div class="panel-group" id="post-panels">
{{ page._posts.each do |post| }}
<div class="panel panel-default">
<div class="panel-heading clearfix">
<div class="pull-left">
<a class="panel-title" data-toggle="collapse" data-parent="#post-panels" href="#{{ index }}">{{ post._title }}</a>
</div>
<div class="pull-right">
dfadf
</div>
</div>
<div id="{{ index }}" class="panel-collapse collapse">
<div class="panel-body">
Anim pariatur cliche...
</div>
</div>
</div>
{{ end }}
</div>
Loading this in my browser results in no panels being displayed, and I find the error "Failed to execute 'querySelector' on 'Element': '#{{ index }}' is not a valid selector." in my Chrome console (full stack trace included at the bottom of this report).
I don't know if it is of any significance, but as soon as I remove the {{ index }}
bit from the bottom div (with the panel-body div inside it), everything displays correctly. For reasons that are obvious, this results in panels which do not collapse or uncollapse.
I know Volt is in its childhood right now. I just wanted to know, am I doing something wrong here? Will I have to try and hunt this issue down myself, or does someone have an idea what might be the problem?
Full stack trace:
Uncaught SyntaxError: Failed to execute 'querySelector' on 'Element': '#{{ index }}' is not a valid selector. dom_template:48
def.$track_binding_anchors.$a._p.TMP_1 dom_template:48
Opal.$yield1 runtime.js?body=1:575
def.$each.TMP_4 hash:228
def.$track_binding_anchors dom_template:43
def.$initialize dom_template:25
def.$new.TMP_2 class:47
def.$set_content_to_template base_section:22
def.$initialize.TMP_1 template_renderer:12
def.$new.TMP_2 class:47
def.$item_added each_binding:100
def.$reload.$a._p.$a._p.TMP_7 each_binding:52
def.$upto.TMP_6 numeric:452
def.$reload.$a._p.TMP_3 each_binding:51
Opal.$yieldX runtime.js?body=1:602
$opal.defs.TMP_5 computation:88
def.$reload each_binding:30
def.$initialize.self.computation.$a._p.TMP_2 each_binding:16
def.$call.TMP_2 proc:22
def.$watch!.$a._p.TMP_6 computation:121
Opal.$yieldX runtime.js?body=1:602
def.$run_in.TMP_4 computation:79
def.$watch! computation:119
def.$initialize.TMP_1 each_binding:16
def.$new.TMP_2 class:47
$gvars.page.$add_template.$a._p.TMP_30 main.js:165
def.$call.TMP_2 proc:22
def.$initialize.$a._p.$a._p.TMP_3 template_renderer:16
Opal.$yield1 runtime.js?body=1:582
def.$each.TMP_6 array:648
def.$initialize.$a._p.TMP_2 template_renderer:15
Opal.$yield1 runtime.js?body=1:575
def.$each.TMP_4 hash:228
def.$initialize.TMP_1 template_renderer:14
def.$new.TMP_2 class:47
def.$render_template template_binding:195
def.$update.$a._p.TMP_5 template_binding:134
Opal.$yieldX runtime.js?body=1:602
$opal.defs.TMP_5 computation:88
def.$update template_binding:103
def.$initialize.self.computation.$a._p.TMP_2 template_binding:20
def.$call.TMP_2 proc:22
def.$watch!.$a._p.TMP_6 computation:121
Opal.$yieldX runtime.js?body=1:602
def.$run_in.TMP_4 computation:79
def.$watch! computation:119
def.$initialize.TMP_1 template_binding:22
def.$new.TMP_2 class:47
$gvars.page.$add_template.$a._p.TMP_32 main.js:171
def.$call.TMP_2 proc:22
def.$initialize.$a._p.$a._p.TMP_3 template_renderer:16
Opal.$yield1 runtime.js?body=1:582
def.$each.TMP_6 array:648
def.$initialize.$a._p.TMP_2 template_renderer:15
Opal.$yield1 runtime.js?body=1:575
def.$each.TMP_4 hash:228
def.$initialize.TMP_1 template_renderer:14
def.$new.TMP_2 class:47
def.$start page:175
$a._p.TMP_5 page:214
x.Callbacks.l jquery.min.js:5
x.Callbacks.c.fireWith jquery.min.js:5
x.extend.ready jquery.min.js:5
S
Hey!
I havent tried yet, but is it possible to host a volt application on heroku?
Is it the same process as pushing a ruby on rails app?
Thanks!
{#each _posts as foo}{foo._title}{#each _posts as bar}{bar._title}{/}{/}
in todos3 example causes this error: RuntimeError: template path already exists: main/blog/index/body/__template/1
. I thought maybe this was related to #36.
I think the heavy use of an underscore prefix in Volt is problematic as the widely accepted use for it in the Ruby community is for unused variables/params. Every time I see something like page._todos
I'm taken aback and I can imagine there will be cases when someone would wonder if _something
is something unused or something from Volt. What's the rationale behind this naming scheme?
I keep track of ruby binaries I like to have on new machines by curating a Gemfile in $HOME
. I use pry
as an irb
alternative, so I've specified it there.
As near as I can tell, the conservative requirement ~>0.9.12
for pry
in volt is causing me headaches.
~/learning/volt
❯ ruby --version
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin14.0]
~/learning/volt
❯ which gem
/Users/jeffh/.rubies/ruby-2.1.2/bin/gem
~/learning/volt
❯ gem which volt
/Users/jeffh/.gem/ruby/2.1.2/gems/volt-0.8.21/lib/volt.rb
~/learning/volt
❯ which volt
/Users/jeffh/.gem/ruby/2.1.2/bin/volt
~/learning/volt
❯ volt new todo
WARN: Unresolved specs during Gem::Specification.reset:
sprockets (~> 2.0)
mime-types (>= 1.16)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
/Users/jeffh/.gem/ruby/2.1.2/gems/bundler-1.7.4/lib/bundler/runtime.rb:34:in `block in setup': You have already activated pry 0.9.12.6, but your Gemfile requires pry 0.10.1. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
from /Users/jeffh/.gem/ruby/2.1.2/gems/bundler-1.7.4/lib/bundler/runtime.rb:19:in `setup'
from /Users/jeffh/.gem/ruby/2.1.2/gems/bundler-1.7.4/lib/bundler.rb:121:in `setup'
from /Users/jeffh/.gem/ruby/2.1.2/gems/bundler-1.7.4/lib/bundler/setup.rb:7:in `<top (required)>'
from /Users/jeffh/.rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:69:in `require'
from /Users/jeffh/.rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:69:in `require'
from /Users/jeffh/.gem/ruby/2.1.2/gems/volt-0.8.21/lib/volt/cli.rb:1:in `<top (required)>'
from /Users/jeffh/.rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:69:in `require'
from /Users/jeffh/.rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:69:in `require'
from /Users/jeffh/.gem/ruby/2.1.2/gems/volt-0.8.21/bin/volt:4:in `<top (required)>'
from /Users/jeffh/.gem/ruby/2.1.2/bin/volt:23:in `load'
from /Users/jeffh/.gem/ruby/2.1.2/bin/volt:23:in `<main>'
~/learning/volt
❯ bundle exec volt new todo
/Users/jeffh/.rubies/ruby-2.1.2/bin/ruby: invalid option -2 (-h will show valid options) (RuntimeError)
Code in view
<table class="table">
{{ directories_to_scan.each do |dir| }}
<tr><td>{{ dir }}</td></tr>
{{ end }}
</table>
and in controller
def directories_to_scan
[:_music_paths, :_new_music_paths].map do |collection_name|
collection = self.model.send(collection_name)
collection.count
collection.map { |path| path._name }
end.flatten.sort
end
Here I need to call .count
on Volt's collections, otherwise method directories_to_scan
returns an empty array.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.