RailsCasts Pro episodes are now free!

Learn more or hide this

Tilo's Profile

GitHub User: tilo

Comments by Tilo

Avatar

Welcome back, Ryan!

Awesome episode!

if the user has a longer list of attributes, this might make the code cleaner:

 def submit(params)
   [:original_password, :new_password, :new_password_confirmation].each do |attr|
     self[attr]= params[attr]
   end
   ...
 end
Avatar

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!

Avatar

check out the other Gem I mentioned in a previous comment - it gives full control over delimiters, column headers, etc..

Avatar

check out smarter_csv for easy renaming of the headers to match your model.

Avatar

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).

Avatar

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..

Avatar

I would also recommend the mongoid-ancestry gem for Mongoid based Rails apps.

Avatar

Thanks for posting the link to Joshua's cookbooks. It looks like 37Signals cookbook has been removed from their Git account, or made private.

Avatar

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..

Avatar

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!

Avatar

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!

Avatar

thanks for the tip! Also works nicely in Sublime Text 2

Avatar

a uniform interface for ActiveRecord and Mongoid would be awesome!

Avatar

looks great! it's nice how this is still in the models, but uses the roles which are maintained somewhere else.

Avatar

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.

Avatar

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.

Avatar
Avatar

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.

Avatar

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.

Avatar

@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

Avatar

thank you Ryan!

finally a tool to see the source code of a method definition!
That was really a feature I missed from Lisp..

Avatar

@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..)

Avatar

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?

Avatar

Much cleaner + leaner than sharing instance variables!

This should be Rails default behavior!

Avatar

Excellent!

Congratulations on episode 2**8 = 256

Avatar

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; }

Avatar

It would be good to have an episode on tableless models with MongoID!