https://www.redmine.org/https://www.redmine.org/favicon.ico?16793021292013-07-27T14:48:27ZRedmineRedmine - Defect #13924: Error when using views/issues/index.api.rsb in a pluginhttps://www.redmine.org/issues/13924?journal_id=508052013-07-27T14:48:27ZVivek Jain
<ul></ul><p>Did you find a solution ? even I am facing the same problem</p> Redmine - Defect #13924: Error when using views/issues/index.api.rsb in a pluginhttps://www.redmine.org/issues/13924?journal_id=508072013-07-27T15:48:45ZEtienne Massip
<ul></ul><p>Could you please post a sample plugin crashing?</p> Redmine - Defect #13924: Error when using views/issues/index.api.rsb in a pluginhttps://www.redmine.org/issues/13924?journal_id=508102013-07-27T16:49:19ZVivek Jain
<ul></ul><p>The file index.api.rsb is in \redmine-2.3.1\plugins\smiles\app\views\timelog <br /><pre>
api.array :time_entries, api_meta(:total_count => @entry_count, :offset => @offset, :limit => @limit) do
@entries.each do |time_entry|
api.time_entry do
spent_on = time_entry.spent_on.present? ? time_entry.spent_on.strftime('%d-%m-%Y') : ''
created_on = time_entry.created_on.present? ? time_entry.created_on.strftime('%d-%m-%Y') : ''
updated_on = time_entry.updated_on.present? ? time_entry.updated_on.strftime('%d-%m-%Y') : ''
api.id time_entry.id
pi.project(:id => time_entry.project_id, :name => time_entry.project.name) unless time_entry.project.nil?
api.issue(:id => time_entry.issue_id) unless time_entry.issue.nil?
api.employee(:id => time_entry.user.employee_id) unless time_entry.user.nil?
api.user(:id => time_entry.user_id, :name => time_entry.user.name) unless time_entry.user.nil?
api.activity(:id => time_entry.activity_id, :name => time_entry.activity.name) unless time_entry.activity.nil?
api.hours time_entry.hours
api.comments time_entry.comments
api.spent_on spent_on
api.created_on created_on
api.updated_on updated_on
render_api_custom_values time_entry.custom_field_values, api
end
end
end
</pre><br />the error log is <br /><pre>
Rendered plugins/smiles/app/views/timelog/index.api.rsb within layouts/base (0.0ms)
Completed 500 Internal Server Error in 815ms
ActionView::Template::Error (No builder for format ):
1: api.array :time_entries, api_meta(:total_count => @entry_count, :offset => @offset, :limit => @limit) do
2: @entries.each do |time_entry|
3: api.time_entry do
4:
lib/redmine/views/builders.rb:28:in `for'
app/controllers/timelog_controller.rb:64:in `block (2 levels) in index'
app/controllers/timelog_controller.rb:51:in `index'
</pre></p> Redmine - Defect #13924: Error when using views/issues/index.api.rsb in a pluginhttps://www.redmine.org/issues/13924?journal_id=526512013-10-18T12:09:57ZKumar Akarsh
<ul></ul><p>Any update on this?<br />In my plugin I am overriding both issues/index.api.rsb and issues/show.api.rsb. Its working fine for show.api.rsb but is giving error for index.api.rsb.</p> Redmine - Defect #13924: Error when using views/issues/index.api.rsb in a pluginhttps://www.redmine.org/issues/13924?journal_id=527092013-10-21T07:29:05ZKumar Akarsh
<ul></ul><p>After trying out few things I eventually figured out a solution for this. If you are overriding api responses i.e views/issues/index.api.rsb in a plugin, you need to override the html view of that action in the plugin as well. So you just need to copy views/issues/index.html.erb to your plugin views.</p>
<p><em>cp app/views/issues/index.html.erb plugins/myplugin/app/views/index.html.erb</em></p> Redmine - Defect #13924: Error when using views/issues/index.api.rsb in a pluginhttps://www.redmine.org/issues/13924?journal_id=548742014-02-17T12:48:49ZDominique Lederer
<ul></ul><p>Kumar Akarsh wrote:</p>
<blockquote>
<p>After trying out few things I eventually figured out a solution for this. If you are overriding api responses i.e views/issues/index.api.rsb in a plugin, you need to override the html view of that action in the plugin as well. So you just need to copy views/issues/index.html.erb to your plugin views.</p>
<p><em>cp app/views/issues/index.html.erb plugins/myplugin/app/views/index.html.erb</em></p>
</blockquote>
<p>that does work, thanks</p> Redmine - Defect #13924: Error when using views/issues/index.api.rsb in a pluginhttps://www.redmine.org/issues/13924?journal_id=614042015-02-09T10:56:11ZVincent Robert
<ul></ul><p>Copy/Pasting views/issues/index.html.erb to the plugin views do fix the error, but we should be able to override the API without modifying the HTML view. Any way to fix the original bug?</p> Redmine - Defect #13924: Error when using views/issues/index.api.rsb in a pluginhttps://www.redmine.org/issues/13924?journal_id=629132015-04-08T09:51:57ZDominique Lederer
<ul></ul><p>with redmine 3 you also have to copy/paste views/issues/index.pdf.erb and views/issues/show.pdf.erb :(</p> Redmine - Defect #13924: Error when using views/issues/index.api.rsb in a pluginhttps://www.redmine.org/issues/13924?journal_id=644932015-06-27T08:04:39ZJean-Philippe Langjp_lang@yahoo.fr
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Closed</i></li><li><strong>Assignee</strong> set to <i>Jean-Philippe Lang</i></li><li><strong>Target version</strong> set to <i>3.1.0</i></li><li><strong>Resolution</strong> set to <i>Fixed</i></li></ul><p>Fixed in <a class="changeset" title="Error when using views/issues/index.api.rsb in a plugin (#13924)." href="https://www.redmine.org/projects/redmine/repository/svn/revisions/14375">r14375</a>.</p> Redmine - Defect #13924: Error when using views/issues/index.api.rsb in a pluginhttps://www.redmine.org/issues/13924?journal_id=655802015-08-23T02:21:58ZNicolas Rodriguez
<ul></ul><p>Hi! It would be nice if this patch was backported to the 2.6.x branch.<br />Thank you!</p> Redmine - Defect #13924: Error when using views/issues/index.api.rsb in a pluginhttps://www.redmine.org/issues/13924?journal_id=670442015-11-03T07:15:33ZRamiz Raja Chaudhry
<ul></ul><p>For <strong>redmine 2.6</strong>, i fixed it by changing one line in <strong>redmine_root/config/initializers/10-patches.rb</strong></p>
<p><strong>Change this block of code</strong></p>
<pre>
class Resolver
def find_all(name, prefix=nil, partial=false, details={}, key=nil, locals=[])
cached(key, [name, prefix, partial], details, locals) do
if details[:formats] & [:xml, :json]
details = details.dup
details[:formats] = details[:formats].dup + [:api]
end
find_templates(name, prefix, partial, details)
end
end
end
</pre>
<p><strong>TO</strong><br /><pre>
class Resolver
def find_all(name, prefix=nil, partial=false, details={}, key=nil, locals=[])
cached(key, [name, prefix, partial], details, locals) do
if (details[:formats] & [:xml, :json]).any?
details = details.dup
details[:formats] = details[:formats].dup + [:api]
end
find_templates(name, prefix, partial, details)
end
end
end
</pre></p>