- Recent
- Popular
- Tags (0)
- Subscribers (1)
- Pagination, Sets, CheckboxesAugust 25
-
When I was at RailsConf2008 I learned a lot about life and Rails but there were some nagging problems that lingered after me for a long time.
At one point in the talks there was a discussion of how to make listing pages have checkboxes and how to handle this data. The problem is complicated by pagination and filtering so it’s actually a really good problem to talk about.
The proposed solution was to send back a structure that looked something like this:
[{:id => 1, :activated => "+", :contact => "-"}, ...]At this point I was probably playing pogs in the audience with Ryan Schenk so the details are lost to time but the concept remains.
It seems needlessly complex though. A very interesting idea, no doubt about it, and it certainly has its merit but it seems very complex to me when we’re talking about booleans. Also, I feel like it’s worth mentioning that this method is much faster than the below method but somehow that doesn’t turn me off that badly.
Instead of the above I took the already well accepted practice of using the check_box_tag in the view with the addition of a hidden field which would tell me which objects to care about:
<% @users.each do |user| %> <%= hidden_field_tag('seen[]', user.id) -%> <%= check_box_tag 'activated[]', user.id -%> <% end %>In the controller it’s as easy as loading up params[:seen] and loading each object:
def index if - RBridge 0.2May 24
-
RBridge has undergone a lot of bug fixes and I think it’s worthy of a 0.2 release at long last.
1 major enhancement
- Actually runs headless via the rulang command.
3 minor enhancements
- Uses optparse for clearer command-line options.
- Option to specify port, compile directory, mnesia directory, sname, and location of server file.
- Some error checking, and debug output added. Checks to see if server is already running on specified port.
You can check it out here or just gem install rbridge
- RBridge-0.1.2 AnnouncementMarch 10
-
Just wanted to poke my head in and let people know that a new version of rbridge has been released. New to this revision is a few little tweaks and bug fixes but the main point is that you can install the gem and just type ‘rulang’ from anywhere to start the erlang server. This enabled us to build a little test suite which should improve quality.
Also, the end of quarter summary has been posted per our class requirements: Review
- Concurrent code in Ruby 1.8.6 through inliningJanuary 7
-
Slight typo in the code fixed: 2008-01-08
Toshiyuki and I have released a new gem called rbridge which allows us to execute functional, side-effect free, concurrent code directly in Ruby regardless of the version by using Erlang as a processor. This includes using the Mnesia distributed database and ETS/DETS.
To try it out please follow these steps:
1. Download Erlang for your os. Windows has binaries and OS X can be configured with `./configure—prefix=/opt/local` to make MacParts happy. I haven’t yet tried it with Linux but the default configure options should be okay.
2. Download the rbridge gem. `sudo gem install rbridge`
3. Start the rulang server in Erlang on port 9900. Change dir to the gem directory which is usually /usr/local/lib/ruby/gems/1.8/gems/rbridge-0.1/lib and run sudo erlc rulang.erl. Enter the Erlang shell by typing erl. Finally, start the server with rulang:start_server(9900). (There’s a dot at the end of the command).
4. Require rubygems and rbridge in your code and create a new connection to the rulang server. This is the simplest bit of inline code I can think of but there is a lot more we can do: asynchronous access and ruby-style syntax specifically.
require 'rubygems' require 'rbridge' @r = RBridge.new(nil, 'localhost', 9900) puts @r.erl('10*10.')To read more check out the documentation on ruby-mnesi
- rbridge 0.1 ReleasedJanuary 4
-
FEATURES:
Allows use of Erlang code within Ruby
Changes:
v0.1 / 2008-01-04 (vosechu)
1 major enhancement
- Allows many-lined Erlang commands when using the Erlang class for direct access.
3 minor enhancements
- Revised error checking to allow custom resolution
- stop_server/0 now shuts down any servers running in an erl shell
- created tests to run with RSpec and autotest (erl server must be running on port 9900).
3 other changes
- Forked onto rubyforge complete with rdocs, gem, etc.
- Translated some comments into english as well as the README
- Packaged explicitly with gpl documentation
