{"id":26836616,"url":"https://github.com/jigneshsatam/lazy_load-rails","last_synced_at":"2026-02-26T16:12:52.023Z","repository":{"id":56880871,"uuid":"87735205","full_name":"jigneshsatam/lazy_load-rails","owner":"jigneshsatam","description":"Load page lazily as and when required","archived":false,"fork":false,"pushed_at":"2017-04-10T19:10:49.000Z","size":26,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-02T15:51:54.765Z","etag":null,"topics":["angularjs","gem","lazy","lazy-loading","load","rails","react","reactjs"],"latest_commit_sha":null,"homepage":"http://lazy-loading-page-app.herokuapp.com/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jigneshsatam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-09T19:56:30.000Z","updated_at":"2017-04-13T07:01:04.000Z","dependencies_parsed_at":"2022-08-20T22:31:14.742Z","dependency_job_id":null,"html_url":"https://github.com/jigneshsatam/lazy_load-rails","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jigneshsatam%2Flazy_load-rails","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jigneshsatam%2Flazy_load-rails/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jigneshsatam%2Flazy_load-rails/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jigneshsatam%2Flazy_load-rails/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jigneshsatam","download_url":"https://codeload.github.com/jigneshsatam/lazy_load-rails/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246320131,"owners_count":20758410,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angularjs","gem","lazy","lazy-loading","load","rails","react","reactjs"],"created_at":"2025-03-30T16:20:34.174Z","updated_at":"2026-02-26T16:12:51.982Z","avatar_url":"https://github.com/jigneshsatam.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lazy_load-rails\n***Load page lazily as and when required***\n***\n\n\nlazy_load-rails is a gem that helps to **load page lazily** as and **when required**. The gem ***reduces page load time*** and ***reduces server ram*** by loading important content of the page in the first call and then by triggering calls to load the remaining page. The gem gives **Reactjs** like **functionality** in your ruby-on-rails application.\n\n## Installation\n\nAdd this line to your application's **Gemfile**:\n\n```ruby\ngem 'lazy_load-rails'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install lazy_load-rails\n\nAdd the following line to your **application.js** file:\n\n    //= require lazy_load\n\nAdd the following line to your **application.css** file:\n\n    *= require lazy_load\n\n## Usage\nCall the following method from view file (.html.erb / .html.haml) and pass a url as a parameter\n\n### .html.erb example\n\n**Passing url as string**\n```erb\n\u003c%= lazy_load(\"http://lazy-loading-page-app.herokuapp.com/notifications\") %\u003e\n```\n**Passing url string with parameters**\n```erb\n\u003c%= lazy_load(\"http://lazy-loading-page-app.herokuapp.com/notifications?page=1\u0026count=5\") %\u003e\n```\n**Passing url as helper method**\n```erb\n\u003c%= lazy_load(notifications_path) %\u003e\n```\n**Passing url as helper method with parameters**\n```erb\n\u003c%= lazy_load(notifications_path(page: 1, count: 5)) %\u003e\n```\n### Configuring lazy loading page\nConfiguration can be achieved by passing parameters to lazy_load method\nFollowing are some **configuration examples**:\n```erb\n\u003c%= lazy_load(notifications_path(page: 1, count: 5), id: \"my_lazy_loader\", type: \"script\", success: \"afterSuccess()\") %\u003e\n\n\u003c%= lazy_load(notifications_path, class: \"lazy_loaders\", loader: \"off\", type: \"json\", failure: \"afterFailure()\", complete: \"afterComplete(my_arg1, my_arg2)\") %\u003e\n\n\u003c%= lazy_load(\"http://lazy-loading-page-app.herokuapp.com/notifications?page=1\u0026count=5\", later: true, id: \"later_lazy_loader\",  failure: \"onSuccess(my_arg1)\", complete: \"onComplete()\") %\u003e\n```\n### Note\nWhen using configuration option `later: true` **explicit trigger** the request call.\nBy calling the function `delayedLoading(elementToLoad);` in your javascript and passing the **lazy_loading element/elements** as argument.\n**lazy_loading element/elements has class** `lazy_load`\n\n***Checkout the*** [***Demo***](http://lazy-loading-page-app.herokuapp.com/)\n\n***lazy-loading-page app implementation*** [@Github](https://github.com/JigneshSatam/lazy_loading_page_app)\n\n\n### .html.haml example:\n```haml\n= lazy_load(\"http://lazy-loading-page-app.herokuapp.com/notifications\")\n\n= lazy_load(\"http://lazy-loading-page-app.herokuapp.com/notifications?page=1\u0026count=5\")\n\n= lazy_load(notifications_path)\n\n= lazy_load(notifications_path(page: 1, count:5))\n\n= lazy_load(notifications_path(page: 1, count: 5), id: \"my_lazy_loader\", type: \"script\", success: \"afterSuccess()\")\n\n= lazy_load(notifications_path, class: \"lazy_loaders\", loader: \"off\", type: \"json\", failure: \"afterFailure()\", complete: \"afterComplete(my_arg1, my_arg2)\")\n\n= lazy_load(\"http://lazy-loading-page-app.herokuapp.com/notifications?page=1\u0026count=5\", later: true, id: \"later_lazy_loader\",  failure: \"onSuccess(my_arg1)\", complete: \"onComplete()\")\n```\n\n## Configurations:\n\n|Attributes|Defaults|Options|Description\n|:----------:|:--------:|:-------:|-----------|\n|type|null|script/json|**Type of request** to be made.|\n|later|null|true|This will **stop the implicit loading** of the request, so that user can **explicit load the request** when required.|\n|id|null|`userdefined`|Can **attach ID** to the object loaded in the DOM, it can be **helpful in explicit loading** of the request.|\n|loader|on|off|This can be used to **turn on / off** the **loading effect**.|\n|class|null|`userdefined`|Can **attach class** to the object loaded in the DOM, it can be **helpful in explicit loading** of the request.|\n\n## Callbacks:\n\n|Callback|Example|Description\n|:-----:|-----------|---------|\n|success| functionAfterSuccess(arg1, arg2); |This function will be called when the request is successful.|\n|failure| functionAfterFailure(arg1, arg2); |This function will be called when the request fails.|\n|complete| functionAfterComplete(arg1, arg2); |This function will be called when the request is completed.|\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\n1. Fork it ( https://github.com/[my-github-username]/lazy_load-rails/fork )\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n\n## License\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjigneshsatam%2Flazy_load-rails","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjigneshsatam%2Flazy_load-rails","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjigneshsatam%2Flazy_load-rails/lists"}