small medium large xlarge

Generic-user-small
07 Jul 2006, 10:07
Fora User (865 posts)

Please go in depth with baked in Restful style webservices like you see at http://jamis.jamisbuck.org/articles/2006/03/27/web-services-rails-style

It would also be nice to see how to consume API services inside of rails. For example, using the ebay web service or the amazon web service to add more products to the depot application and maybe even an example of sending back the information to these services.

thanks jake

Generic-user-small
24 May 2006, 21:44
Fora User (865 posts)

Well, my last post got swallowed up, let’s try again:

  • new ActiveSupport stuff should at least get reference documentation (to_json, etc.)
  • as much about RJS as you can stand to write
  • thorough discussion of has_many:through and other new relationships
Generic-user-small
10 Jul 2006, 08:23
Fora User (865 posts)

As a newbie, I haven’t been daring enough to try any of the plug in’s on the rails wiki but it looks like there some good stuff there… “Validates Date Time”, “Validates Numericality Of”, “Live Tree” for example. An example of how to install would be helpful and maybe what considerations are needed when deploying?

Generic-user-small
11 Jun 2006, 02:31
Fora User (865 posts)

I’d like to see a better login system for the depot application in the next edition of the book. At this point, you only have one group of users, the administrator. It would be great if you would show how to implement it so that users of the webshop could sign up for an account, too. Every webshop has this so that the user doesn’t need to enter his data every time he buys something, and you need this for a bunch of other applications. Say you’d want to make a community web application, you wouldn’t need just administrator accounts, but user accounts, too. This would make the example application for the book a much better starting point. Sure, you could just do this on your own with the things you learned in the book, but as the depot application is the only example application in the book, it would be great if it would have a bit more features where you can learn from how to do things right.

Generic-user-small
23 May 2006, 23:50
Fora User (865 posts)

tutorial on a quicksetup of login engine or some other engine that is just enough info for a user to learn the rest himself.

Generic-user-small
24 May 2006, 21:42
Fora User (865 posts)

Agreed, but this would add a whole lot to the application. You might want to have a look at Rails Recipes for Role-based authenication.

Generic-user-small
24 May 2006, 21:42
Fora User (865 posts)

I’m planning either a major section or a full chapteron plugins.

Dave

Generic-user-small
24 May 2006, 21:44
Fora User (865 posts)

Yup, that’ll all be there.

Dave

Generic-user-small
24 May 2006, 21:45
Fora User (865 posts)

I’ll have more on the restful stuff, but probably not of the web services.

Generic-user-small
06 Jul 2006, 00:03
Fora User (865 posts)

The Rails train is moving fast, and the Rails team does a good job at keeping track at the Rails blog. There’s a lot of gems in the wiki as well. Examples include changes in trunk that developers should be aware of up front, tips ‘n tricks, and examples of open-source Rails applications for anyone to be find inspiration and learn from.

A short paragraph on the blog and wiki may be worthwhile.

Generic-user-small
07 Jun 2006, 07:47
Fora User (865 posts)

The rails documentation set as a whole is rich in examples and relatively short on definitions. I mean the kind of precise definition we see in good API documentation. The RDOC is great in places but has numerous holes scattered throughout.

Since open source developers of application documentation are rare, perhaps a good “Guide to the Rails Source Code” chapter would be appropriate. Using the source is much easier with a guide.

And the first book had too little discussion of the use of breakpointer and console. There are a world of .irbrc hacks out there and they should be provided in a rail-compatible way. The redhanded blog has some of these.

It is also too much trouble to add the rails information to ri and to fxri. If you could publish a guide on how this can be done it would help. Searchable documentation is much more useful.

Generic-user-small
30 May 2006, 21:04
Fora User (865 posts)

Some of these behavioral thingies are a little abstract. A person could misconstrue the intent of a relationship. Definitions and examples for each of the ‘acts as’ variants are really required. The examples would need to show some actual data. I think those diagrams with boxes and arrows and real data explain the core of things the best. The definitions tend to be abstract and are only easy to understand once you’ve grasped the basic idea of the ‘acts as’ behavior.

Most people find they discover the edge cases and ambiguities when creating actual test data and writing up good clear descriptions. Code can miss the edge and corner cases, but is obviously necessary.

This whole topic abuts relational algrebra which is clearly, as a whole, beyond the scope of your book. But there is no avoiding it.

Generic-user-small
30 May 2006, 21:07
Fora User (865 posts)

That is, code that the rails developers use to test Rails. And code that is hopefully in a regression testing suite.

I’ll bet some of that would make good examples or mini-examples. You could put it online or in the text of the book.

It could become a book of it’s own. Small circulation, though.

Generic-user-small
10 Oct 2006, 03:50
Fora User (865 posts)

This is a vipers nest. There are no complete solutions. From get-text to I18N it is complex. We need help. The Japanese version is m17n, or was. We need a guide. There are some web sites with information but support from inside Rails is needed.

I guess this is a rails request as much as a book topic. Which makes me off-topic. So sue me. The book can describe the current state of affairs and tell us what to avoid. If the current state of affairs is such that I need to avoid Unicode, I18N, or RTL (in order of complexity) then you should tell us.

Does rails have (or need) special support for <RTL> tags? This is what is used for right-to-left Hebrew and Arabic. Maybe Farsi as well. Ayatollahs on Rails? Rabbis on Rails? I have real live (potential) customers for this. Mostly Hebrew. And I am at sea. If you don’t have a boat I’ll take a life raft.

Generic-user-small
05 Jun 2006, 23:15
Fora User (865 posts)

Although it seems simplistic in nature, coding the ability to limit values of one drop down based on the selected value of another dropdown caused me a ton of problems initially. I have read your book as well as a large percentage of the Rails Recipe book. In addition, I ended up searching/reading a variety of additional blogs/websites before I got it to work perfectly.

This is such a simple scenario that is used by almost anyone and having an example in your new book would likely go a long way towards helping others be pragmatic!

Please consider it for your new edition - fantastic job on all work to date. Some of the most pleasureable reading I have done in a while.

Thanks,

Mauricio

Generic-user-small
07 Jun 2006, 07:47
Fora User (865 posts)

I agree. Novice users that just finished reading the book just know that there is this whole world of Railties to be found. But where to look for them effectively beyond the examples provided?

I’ve found “RailsHelp”:http://www.railshelp.com and the “FireFox DevBoi extension”:http://devboi.mozdev.org/ to be of great use. I agree that the source code provides even more clarity at times, but things like these are great for starters.

Generic-user-small
11 Jun 2006, 02:31
Fora User (865 posts)

I bought the Rails Recipes book and it’s exactly what I needed. Thanx a lot for the info ;)

Generic-user-small
16 Jun 2006, 18:15
Fora User (865 posts)

Since MySQL is pretty much a prerequisite to the project in the first edition, and it is supposed to be for novices and professionals, why not just a little more on MySQL? Many newbies prefer to use a GUI front-end, like MySQL-Front or Navicat, for good reason. I’ve seen other Rails tutorials online that did include such info, and it was extremely helpful.

Generic-user-small
20 Jun 2006, 00:49
Fora User (865 posts)

Strongly, strongly seconded! You don’t need to go as far as RTL or non-latin character sets to encounter problems here. As soon as you decide to use unicode and have one non-ASCII character, bets are starting to be off.

Ruby has uncertain support for unicode, and even less documentation about it, and Rails also makes a lot of assumptions about using English only.

Some advice on how to setup the application, special headers, meta tags, database setup and more could be really helpful, at the very least as a checklist.

This could easily be one of the most important chapters in the book, if done well. (Wouldn’t mind seeing such a section in Programming Ruby, either, for that matter).

Generic-user-small
23 May 2007, 14:37
Fora User (865 posts)

collection_select is constantly used in my applications to establish relationships. Unfortunately, the book contained the code

<%=

@users = User.find(:all, :order => “name” )

collection_select(:user, * :name*, @users, :id, :name)

%>

so I did this in my code:

<%=

collection_select( :question, * :section*, @sections, :id, :section_title )

%>

This got me a nice big:

ActiveRecord::AssociationTypeMismatch in Admin/questionController#update

Section expected, got String

The code I ended up doing was this:

<%=

collection_select( :question, * :section_id*, @sections, :id, :section_title )

%>

I’m not even sure if this is right but I use combo boxes for realationships between tables/models. In forms, this comes only second to text fields. I’d like to see more about collection_select from the people that know how to pragmatically use it.

Generic-user-small
06 Jul 2006, 00:01
Fora User (865 posts)

It would be good if the book contains some more of RJS.I bought the book, mostly for more information on RJS,Migrations and few other advanced stuff.I have the first edition also…so little more information about RJS and few other advanced topics would be good.

Generic-user-small
27 Jun 2006, 07:21
Fora User (865 posts)

I haven’t bought it yet myself, but there was an announcement for a PDF called “RJS Templates for Rails” on the Rails blog.

Generic-user-small
28 Jun 2006, 14:49
Fora User (865 posts)

Sometimes I miss the Beef. What I try to express with that are a few down to earth comments regarding the underlying mechanics. A good example is the data type relationship between database and ruby/rails. Right now I am confused like hell. In the first edition I could relate very well to the SQL DB definition of field datatypes and then the subsequent use of that structure by Ruby/Rails. I could abstract what’s going on under the hood. In the second edition the migration methodology is used, which looks way more elegant. BUT, how are the string fields represented? Will the system allocate more space and switch to another text/longtext/string/varchar?????? structure once a user copies and pastes a few kilobytes into a text field? Or will all the oo goodness surrender into one exception while bellying up and showing it’s limits. And if… how to affect the generation of the underlying DB types?! … You get the point… The release 2 of the book seems to become a more abstract work about the oo goodness of it all and has lost a bit the direct relation to the problems fromthe view of the slightly confused migrating engineer. I might change my mind once I get deeper and deeper into it but right now I’m confused an unsafe enough that I am actually sitting here with my beloved version one paperback with all the torn edges while the slick PDF of the version two is on the backup tape till I can understand it after working through version one….

Sorry for the rant but I think that a few comments here and there, thrown in as life saver would be fantastic.

Cheers Rainer

Generic-user-small
26 Aug 2006, 02:46
Fora User (865 posts)

Would love to get more information about ActiveResources in the book. I guess there is not much more I need to say here :-).

Generic-user-small
06 Jul 2006, 00:01
Fora User (865 posts)

I’ve bought Cody Fauser’s PDF RJS Templates for Rails and it’s very good indeed. For nine bucks, you can’t go wrong.

Generic-user-small
06 Jul 2006, 00:03
Fora User (865 posts)

I think there’s some listings of resources like this in the last section of the book? Or else the first section? I know I saw a list of the main players’ blogs, the wiki, etc.

Generic-user-small
07 Jul 2006, 10:07
Fora User (865 posts)

It would be nice to see practical use case of respond_to. I guess that one can use it to make same app work on browsers with JavaScript enabled (Ajax app) or not (old HTML).

Next important thing I would like to see is what I can do with XML or JSON object on browser side. You cannot simply replace existing HTML DIV contents with XML or JSON object. You have to convert XML or JSON to HTML and then paste result to a page. Does RoR or Prototype JavaScript library support this?

I guess that some will advise to use RJS to render HTML on server side (one code to render but more data to send). What is official RoR way of utilising XML and JSON on browser side?

Regards,

Generic-user-small
10 Jul 2006, 08:23
Fora User (865 posts)

Great! This is a big hole in my knowledge base for me as well.

Generic-user-small
19 Jul 2006, 13:12
Fora User (865 posts)

partial post by accident. SORRY!!

Generic-user-small
19 Jul 2006, 13:11
Fora User (865 posts)

partial post by accident. SORRY!!

Generic-user-small
22 Nov 2006, 22:05
Fora User (865 posts)

I’ve been through the construction of the depot application in the 1st edition of the book and have followed along in the 2nd to catch up on new concepts and techniques introduced in the 2nd version.

One thing I’m having a problem with (and wrapping my head around) is exactly how to deal with the linking of database tables and ROR models via foreign keys.

This may be a good addition to the book (i.e. a brain dead simple example of how to link up foreign key linked tables)

In my case, I have:

Book has_many :reviews

and

Review belongs_to :books

(I’m leaving out for now that each Review has_one Book)

I’ve created the book_id column for storing the foreign key in the DB. Now what I’m trying to do is create a link from the list of books that allows me to create a review for the given book (and automatically uses the id of the book as the foreign key for the row created in the DB to store the review). It seems like it should be easy and should occur nearly by magic, but I am missing something.

I pass the id of the book to the controller…

<%= button_to “Add Review”, :action => :add_review, :id => book.id %>

and then it gets hazy…

def add_review p((. # have to create the Review object in memory to receive input from the form…

p((. @review = Review.new

def save_review p((. # have to populate the Review object with input from the form…

p((. @review = Review.new(params[:review])

p((. if @review.save

p((. redirect_to :action => ‘index’

p((. else

p((. render :action => :add_review

And that’s where it falls apart. The review is saved to the DB but it is orphaned (without a book_id).

I’m sure it’s something simple that I’m missing, but I don’t (yet) have the grasp of how to build things in ROR to fix it.

I’ll keep reading…

Thanks!

Jacob

Generic-user-small
24 Jul 2006, 12:17
Fora User (865 posts)

A review belongs to a single book. So write:

belongs_to :book

instead of

belongs_to :books

Generic-user-small
24 Jul 2006, 12:29
Fora User (865 posts)

Though PostgreSQL is often abbreviated Postgres, it really should be PostgreSQL. (PostgresSQL stems from Postgres95 which stems from Postgres.) (Dave says: it probably should, but I’ll stick with the common usage. PostgresSQL is unpronouncable… :)–R.S.A. van Domburg

I’d like to raise this point one more time. Rails itself calls PostgreSQL just that, and on more than one occassion too. Try:

rails my_project –database=postgresql

and then peek in config/database.yml.

Further references in an attempt to sway you: :-) * “How do you pronounce ‘PostgreSQL’? community poll at postgresql.org”:http://www.postgresql.org/community/survey.33 * “MP3 over at Wikipedia”:http://en.wikipedia.org/wiki/PostgreSQL

Generic-user-small
27 Jul 2006, 15:48
Fora User (865 posts)

I really like the chapter on migration but there is one thing missing. When you talk about using migration to import data, the code you use requires a model/class of the corresponding fixture. But how can you load the link table between two HABTM classes?

I am sure there is an easy way to do this and it should be added to the book because sooner or later someone will have the same problem as me right now…

Oh, and if anyone has an idea on how to do this, plz stand up!

Thanks!

Generic-user-small
10 Aug 2006, 05:33
Fora User (865 posts)

I too would love to see more about this. I think so far having unicode text within a form field doesn’t cause too much as far as problems. However, I’m sure if you tried to use unicode for the ruby source, the entire thing would blow up.

Generic-user-small
26 Aug 2006, 02:46
Fora User (865 posts)

I second a request for details about ActiveResources and in particular examples building on David Heinemeier Hansson’s suggestion that applications be modelled under the constraints of CRUD.

I think that although people appreciate the ideas David discussed in his “Resources On Rails” talk, many do not understand how to implement them for anything other than the most basic of applications and model relationships.

This is relevant for this book as it now seems to be common practice to structure Rails applications using this methodology.

Generic-user-small
29 Sep 2006, 17:39
Fora User (865 posts)

Section 3.5 briefly touches the “Continious Integration”:http://en.wikipedia.org/wiki/Continuous_integration subject. I believe it’s an important subject especially for somewhat larger teams. Maybe explain a little in the book about “Cerberus”:http://rubyforge.org/projects/cerberus as the “DamageControl”:http://docs.codehaus.org/display/DAMAGECONTROL/Home project seems to be hibernating.

Generic-user-small
28 Aug 2006, 15:06
Fora User (865 posts)

What I’d like to see is a section that cover “Code Coverage”.

I suggest “Rails Plugin: rails_rcov”:http://www.agilewebdevelopment.com/plugins/rails_rcov , is based on “rcov: code coverage for Ruby”:http://eigenclass.org/hiki.rb?rcov

PS: I’m sorry for my poor english.

Generic-user-small
29 Aug 2006, 00:27
Fora User (865 posts)

I’d like to see more written about how to get Rails to work with existing Apache/Lighttpd setups, where you may not be exclusively serving Ruby on Rails with the webserver. I had a terrible time getting Lighttpd to do what I wanted, after giving up with Apache.

Generic-user-small
30 Aug 2006, 09:21
Fora User (865 posts)

RoR works great for web1.0 applications. But when it comes to web2.0 applications one can face some problems. AJAX is very young technology and RoR is still evolving is this field. So to write a good chapter on web2.0 apps might be a hard task.

Anyway I would like to see in “The Web, V2.0” chapter following topics: - how to handle model errors generated by validations in an AJAX response - how to handle browsers with JS disabled

In my apps I use flash[:notice] and errors partial to show error messages. AJAX updates the notice HTML DIV and browser without JS simply reloads the whole page. But it would be nice to mark negatively validated form fields. This approach doesn’t solve that issue. Also that kind of solution smells like web1.0.

I am curious if it is possible to convert standard model validations to JS. Similar to RJS. It is a bad solution to write Ruby validations and then rewrite them in JS.

Generic-user-small
12 Sep 2006, 22:17
Fora User (865 posts)

The habtm section is weak. The current version of the book doesn’t show how one might edit or delete a row in such a join table.

I’ve created more complex join tables (“through”) that I can manipulate just fine. Why? Because they have ids. I can just do “MyJoinTableWithId.delete(the_id)”.

The problem is how to edit or delete a row in a habtm join table that has no id. Okay, maybe editing isn’t needed. I can delete and add instead. But how do I delete the item?

The book doesn’t really give any clues in the current iteration. Sure, there’s a table of automatically added functions, but it’s in shorthand with no descriptions or examples, so it’s not of much help.

Thanks for listening. Overall, the beta book has been an excellent resource!

Generic-user-small
12 Sep 2006, 22:17
Fora User (865 posts)

Btw, the solution for deleting is as follows…

Let’s say you have a habtm relationship between roles and people. You can delete a row in the join table in either of the following ways:

some_person.roles.delete(some_role)

some_role.people.delete(some_person)

-JF

Generic-user-small
11 Jun 2007, 20:55
Fora User (865 posts)

maybe a newbie one, but… almost every book which propose exercises to readers also has solutions to them, so why not adding (possible) solutions to playtime exercises? they would work both as hints if one cannot solve alone and as checkout for reader’s work.

Generic-user-small
28 Sep 2006, 09:38
Fora User (865 posts)

Hi Dave(s),

First, I’m very happy with the 2nd edition so far. It’s very exciting to look for notices of an update in my email Inbox!

I don’t even know if this is possible, but I wonder if there’s a way to automatically generate an email at a given time. I don’t figure just setting the “sent at” property for the mail actually controls when it will be sent.

The examples in the first edition show how to create, send, receive, etc. Is there a way to generate one without a request from a browser? (i.e. like through a cron-like thing or something.) I’m thinking in terms of mailing out a report or something on a periodic basis.

Thanks, and keep up the great work! Mike P

Generic-user-small
29 Sep 2006, 17:39
Fora User (865 posts)

I agree with Tom. The best we’ve been able to do, since we use both Java and Ruby, is use CruiseControl and Ant. Unfortunately, we use the exec task in Ant and it seems like Ruby is a third class citizen when going this route. I don’t know if we’re the norm or the exception. Also, it looks like this topic has overlap with the Rails for Java Developers book.

Generic-user-small
10 Oct 2006, 03:50
Fora User (865 posts)

A chapter on I18N would really be very usefull. Java has a good I18N support, and separte books just on I18N. Rails has the potential to make I18N simpler, and I could imagine that there could be a a very nice DRY solution for I18N.

I do not expect this book to address all of I18N, but if it would at least give an idea on how to do it, and then a few references for further reading.

(I am currently writing an app, where I need to be able to at least support English, French, German and Italian -> in addition to the translation you have different date, number and time formats …)

Tomi

Generic-user-small
29 Nov 2006, 22:32
Fora User (865 posts)

For a newbie to this SVN stuff, a detailed section of how to really install EdgeRails and maintain it via SVN will help a lot!

Generic-user-small
30 Oct 2006, 19:02
Fora User (865 posts)

A little more discussion on how Rails maps mysql datetime to DateTime object would go a long way toward helping build real world applications.

More examples!

How to query records sets according to time/date range the rails way, without resorting to injecting an ugly sql where clause.

Rails makes date inputs easy with helpers. But it also doesn’t check that you entered an invalid date, such as Feb 30. This was frustrating as a newbie.

How to set the time zone of your rails application?

How to run rails jobs at certain times with a cron?

Generic-user-small
30 Oct 2006, 19:15
Fora User (865 posts)

A section on how to use SSL with rails. There was no mention of how to do this in the first book.

As a newbie I tried to use my host’s shared SSL for the longest time. The url rewriting makes that very confusing and I gave up and bought my own SSL cert.

Helpful discussion:

With an SSL domain name, how to make sure the user uses https on the checkout page, and redirect him to a secure page if not?

How to make a start_form tag post to a secure page? Or redirect from a secure page to a non-secure page and avoid IE’s “you are about to submit to a non-secure page” warning?

Also if the domain name is typed without “www” and suddenly redirected to a secure page with “www” as the certifcate requires, the user’s session will not be passed since the domain name is different. A discussion for how to compensate for that would be helpful.

Generic-user-small
30 Oct 2006, 19:18
Fora User (865 posts)

In the first book there was no garbage collection for sessions.

We had to manually clean up the session files with a cron.

Is there now garbage collection for sessions? Even if using database to store?

How to track if a user is online with their session?

Generic-user-small
30 Oct 2006, 19:30
Fora User (865 posts)

In the first book, webservices chapter was very thin, not nearly as detailed as some other chapters.

With the release of Google Checkout, I tried to use that chapter to enable my shopping cart and administration panel to do a level 2 google checkout integration but gave up. More basic concepts need to be elaborated on, at least it’s still confusing to me.

Doing some digging on the internet, I finally found a way to do a level 1 integration with google checkout by producing xml from my shopping cart and submitting it base64 encoded with a form post.

But I still haven’t figured out how to consume webservices using rails.

Generic-user-small
22 Nov 2006, 22:05
Fora User (865 posts)

I’m struggling with the same issue. Have you figured out how to resolve it?

In my case, I’m trying to set up a site for a football league with teams, players, games, results, etc. A team has players. So, when I view a list of teams, I want to have a link next to it which allows me to Add Players to team. This should display a form for a player’s info (Name, DOB, etc.) but somehow be linked, visibly or hidden, to the team. OR, there should be a drop-down list of Teams from which to select the player’s team. (I can see this as being useful in the future in the case of a transfer…)

Help!

David

Generic-user-small
29 Nov 2006, 22:32
Fora User (865 posts)

I second this.

I am also getting into subversion and agree that a section regarding how to setup svn the rails way would be very helpful. SVN might be slightly beyond the scope of the book, but even some footnote of advice on the best way of making changes to a live website without breaking it are useful, as there is not much information on this for newbies. Although rails allows you to boot into 3 modes: test, development, production, it wasn’t until a year later, after discovering svn, that I’ve found it much better to develop on a local copy (instant rails + rad rails), then commit changes to the repository then update the live site on the host. If anything breaks, you can roll back.

Generic-user-small
23 May 2007, 14:37
Fora User (865 posts)

This helped me, http://shiningthrough.co.uk/blog/show/6

Generic-user-small
11 Jun 2007, 20:55
Fora User (865 posts)

Because the truth is that if the answers are these, many people will put just a smidge of effort in to get there on their own and then will quickly weasel out by copying the answers without thinking about them. This is a dis-service to the reader.

It’s eminently satisfying when you actually achieve this on your own.

Generic-user-small
29 Aug 2007, 06:25
Fora User (865 posts)

This is one feature that should be addressed – it has given me much headache trying to use acts_as_tree and display a working menu for selecting the category of a product.

Issues to consider:

  • It is possible that a product could live in more than one category
  • Displaying the categories tree as a navigation menu requires a hackup of nested <ul> html spitter-outter routine (ugly as sin)
  • Coming up with a reasonable of managing categories, and assigning producst to them is easier said then done.
You must be logged in to comment