How to change a layout for a particular method:
(1)suppose if ur following a particular layout for ur application(application.rhtml)
(2)if u dont want this layout for a method eg.edit
just create another layout for that method eg.layout/editlayout.rhtml
and specify in that method as
def edit
render :layout => 'editlayout'
end
How to specify background image in stylesheet
=>Suppose if u r not getting the background image even though u specify in ur stylesheets like
background-image:url(/img/hp_bg.png);
the current usage in rails try this
background: url(../images/background.jpg)
How to use in_place_form_edit in Rails 2.0
(1)first u need to install the plugin from svn
>ruby script/plugin source http://svn.rubyonrails.org/rails/plugins/
>ruby script/plugin install in_place_editing
(2)Because it is unsupported the in_place_edit plugin has not kept up with changes to rails. This has resulted in the plugin not working with Rails 2+ because of the Cross-Site-Request-Forgery (CSRF) security modifications that include a authenticity token with every non-GET request.
(3)View the patch located http://dev.rubyonrails.org/attachment/ticket/10055/in_place_editing_should_work_with_csrf_and_rjs.patch
and by hand change the code in yourapp/vendor/plugin/in_place/editing/test/in_place_editing_test.rb. The red lines are deleted/replaced and the green are the new lines that are added.
(4)In the controller
class TaskController < ApplicationController
in_place_edit_with_validation_for :task, :title
(5)In views do like this for the field u want to edit
<%@task=task %><%= in_place_editor_field :task, :title %>
(6)Then start ur server and you will see really how simple it is
(7)so u think it is finished no way there is a bug in this if u just press OK with empty field u will get u know that ur really in trouble.So to make ur day happy go through this url to make validations
>validations for in_place_form_edit
http://www.pluitsolutions.com/2007/03/20/custom-in_place_edit-with-validation/
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment