trailblazer / roar-rails

Use Roar's representers in Rails.
http://roar.apotomo.de
MIT License
235 stars 65 forks source link

`render` accepting status, (or any other attributes for that matter) #88

Closed christopherhein closed 9 years ago

christopherhein commented 10 years ago

I've been using the include Roar::Rails::ControllerAdditions::Render helpers so that I can still make use of classic render, but apparently it doesn't accept extra params, such as status code… I maybe mistaken but it looks like https://github.com/apotonick/roar-rails/blob/master/lib/roar/rails/controller_additions.rb#L80-L83 only cares about the format:

def render(options)
  format = options.keys.first
  super format => prepare_model_for(format, options.values.first, options)
end

I have a simple fix fork here… https://github.com/christopherhein/roar-rails/blob/render-status-code/lib/roar/rails/controller_additions.rb#L80-L84 I've been trying to figure out if there are other params that should be passed correctly…

Let me know what you think… I can always put a pull request… Thanks!

apotonick commented 10 years ago

Yeah, I knew this is a bug but was too lazy to fix it. :grin: A PR and a test for this would be great! :heart_decoration:

christopherhein commented 10 years ago

Awesome, I noticed this after I commented and it might be a dupe… https://github.com/apotonick/roar-rails/issues/67 although I could be wrong, I'll try and get something running and put in a PR…

apotonick commented 10 years ago

Ah yeah, right, that is indeed a duplicate! I knew I've seen this issue before but didn't remember #67 - very rare, but sometimes even I do forget about one of my 213498761123123440 issues. :wink:

PR would be great!