3 ms·
Thanks, this was helpful, especially fields_for. On the point of building my own, that's what I've done, but these felt like an obvious things to want (I imple
by Robin_Message 16y ago
Thanks, this was helpful, especially fields_for.
On the point of building my own, that's what I've done, but these felt like an obvious things to want (I implemented them both in my own PHP framework.) Thinking about it, the standard Rails CRUD index provides delete links instead of buttons; IMHO that is totally wrong, but when all you have is a hammer... Also, button_to is not good enough as it makes its own form, which breaks any solution to question 2.
On question 1, what I want is to generate submit buttons like <input type=submit name=some_non_clashing_string_that_identifies_this_button value=ButtonText> and then have this routed to a function nicely. I've not found a standard way of doing that; maybe I should write one? Could you see it being useful?
- epochwolf 16y agoIt definitely sounds like you are doing something wrong. Rails really wants you to do things it's way. You don't have to, rails, especially version 3, is only generated html and routes to functions. It just generates a lot of stuff for you. If you want to work outside of the provided functionality it's just going to be harder. In fact the application I'm using at work right now uses ExtJS for views and half of the data is retrieved through manual queries. Rails is not designed to do this but it can work, if you are willing to put in the effort to work around missing functionality. I do not recommend using rails as a hammer, it's a very bad hammer. It's a chainsaw with diamond teeth and a 50 hp gas-powered engine. If you have a lot of wood to chop through, it's amazing. If you need to pound in a few nails, it's a little awkward. :)
- xentronium 16y agoYep, for something simple just use Sinatra / other microframeworks.