This is awesome! I've been using an early version of RABL in the past, and it seemed a bit hackish. I did not like the RABL syntax, and there were quite a lot of corner cases where it would not work as expected.
active_model_serializers looks much more stream-lined
it addresses the issue of reading large CSV files (I tried it with more than a million rows), and can process them in chunks, e.g. for creating Resque jobs (if you want to de-couple the processing from the CSV-file reading).
It gives more control over how the CSV is imported, e.g. can manipulate, re-write, or replace column-headers; it can read data in chunks for more efficient post-processing (e.g. with Resque); it can deal with non-standard record separators; and more..
Having to write a private method for every model where parameters are modified, and to hard-code the roles in there, seems to be very cumbersome and well, hard-coded. I like how you extracted this into a class.
I wish there was a tight integration with declarative_authorization, where the roles and permissions live in a separate configuration file and can be more easily changed in one location.
Just wanted to mention that in the Mongo Shell you can use .pretty() at the end of your query, so you can get the pretty-printed output in mongo shell. This is similar to what you would get with "awesome_print" in irb or the rails console.
There is a problem with polymorphic associations if the polymorphic side has Single Table Inheritance: then it will only list the base class as the type.
Using the t() method, it can sometimes be confusing which key in the i18n file Rails is trying to look up.. there doesn't seem to be a consistent naming convention in Rails.
e.g it uses different locations for form labels, buttons, helpers, titles, strings in controllers or models, etc..
The following page provides a table with examples, as well as a tip on how to monkey-patch the i18n Gem in development mode, so Rails will tell you the i18n-keys it tries to look up.
@Amr: you'd need to create a directory under 'views' for each of the subdomains.. (note that you can decide yourself how to structure your custom view_path, this way you can reflect whatever directory structure you like..)
Welcome back, Ryan!
Awesome episode!
if the user has a longer list of attributes, this might make the code cleaner:
This is awesome! I've been using an early version of RABL in the past, and it seemed a bit hackish. I did not like the RABL syntax, and there were quite a lot of corner cases where it would not work as expected.
active_model_serializers looks much more stream-lined
thank you, Ryan!
check out the other Gem I mentioned in a previous comment - it gives full control over delimiters, column headers, etc..
check out smarter_csv for easy renaming of the headers to match your model.
You might also want to check out this gem for importing CSV:
https://github.com/tilo/smarter_csv
it addresses the issue of reading large CSV files (I tried it with more than a million rows), and can process them in chunks, e.g. for creating Resque jobs (if you want to de-couple the processing from the CSV-file reading).
You might also want to check out this gem for importing CSV:
https://github.com/tilo/smarter_csv
It gives more control over how the CSV is imported, e.g. can manipulate, re-write, or replace column-headers; it can read data in chunks for more efficient post-processing (e.g. with Resque); it can deal with non-standard record separators; and more..
I would also recommend the mongoid-ancestry gem for Mongoid based Rails apps.
Thanks for posting the link to Joshua's cookbooks. It looks like 37Signals cookbook has been removed from their Git account, or made private.
there are two GitHub projects which fork Resque and replace Redis with MongoDB:
https://github.com/streamio/mongo-resque
https://github.com/nfo/resque-mongo
This looks pretty awesome!
Not sure which one is more stable and/or feature-complete..
there are two GitHub projects which fork Resque and replace Redis with MongoDB:
https://github.com/streamio/mongo-resque
https://github.com/nfo/resque-mongo
This looks pretty awesome!
Ryan, your approach with truly nested templates for JSON nicely circumvents some problems I've encountered with RABL.
This can also be used to extract a JSON paginator into a template which can then be used across different models.
Thank you, Ryan for this awesome Railscast!
thanks for the tip! Also works nicely in Sublime Text 2
a uniform interface for ActiveRecord and Mongoid would be awesome!
looks great! it's nice how this is still in the models, but uses the roles which are maintained somewhere else.
great RailsCast!
Having to write a private method for every model where parameters are modified, and to hard-code the roles in there, seems to be very cumbersome and well, hard-coded. I like how you extracted this into a class.
I wish there was a tight integration with
declarative_authorization
, where the roles and permissions live in a separate configuration file and can be more easily changed in one location.Awesome Railscast!
Just wanted to mention that in the Mongo Shell you can use
.pretty()
at the end of your query, so you can get the pretty-printed output in mongo shell. This is similar to what you would get with "awesome_print" in irb or the rails console.Hirb also renders Mongoid documents in a MySQL-like table!
replacement for 'rails dbconsole' for Mongoid:
http://crumbtrail.chesmart.in/post/1334264255/handy-bits-for-mongoid-with-rails-3
There is a problem with polymorphic associations if the polymorphic side has Single Table Inheritance: then it will only list the base class as the type.
excellent revised episode!
Using the t() method, it can sometimes be confusing which key in the i18n file Rails is trying to look up.. there doesn't seem to be a consistent naming convention in Rails.
e.g it uses different locations for form labels, buttons, helpers, titles, strings in controllers or models, etc..
The following page provides a table with examples, as well as a tip on how to monkey-patch the i18n Gem in development mode, so Rails will tell you the i18n-keys it tries to look up.
http://www.unixgods.org/~tilo/Rails/where_is_Rails_trying_to_lookup_L10N_strings.html
I hope you'll find it useful.
@Ryan: excellent RailsCast, as always!
the following article from RABL's author Nathan Esquenazi is very interesting, and may be a good addition to the references section:
If you're using to_json, you're doing it wrong
thank you Ryan!
finally a tool to see the source code of a method definition!
That was really a feature I missed from Lisp..
@Amr: you'd need to create a directory under 'views' for each of the subdomains.. (note that you can decide yourself how to structure your custom view_path, this way you can reflect whatever directory structure you like..)
Thanks for compiling all the changelog info into one comprehensive list -- very helpful!
As for the new design:
I'll miss the old intro / music :) -- people already
associate it with "RailsCasts" ... I wouldn't change that.
Everything is easily accessible -- great job!
Could you add the category tags for each episode into the "snippet" overview? Perhaps to the right of the "Watch Episode" button?
Much cleaner + leaner than sharing instance variables!
This should be Rails default behavior!
Excellent!
Congratulations on episode 2**8 = 256
Good find! Thank you!
I love that it uses HTML5 tags, e.g. <nav>
Some browsers don't understand HTML5 tags yes, e.g. Firefox <= 3.6
To work around this, tell the browser which new tags are blocks:
header, footer, nav, article, section, aside { display: block; }
It would be good to have an episode on tableless models with MongoID!