- Oct 2024
-
-
Enhances ActionMailer to support the :cache delivery method, which behaves like :test, except that the deliveries are marshalled to a temporary cache file, thus making them available to other processes.
-
- Aug 2024
- Jul 2024
-
medium.com medium.com
-
This is classic Rails Magic - a clever side effect that guarantees the token in the session cookie will always match the token on the page, because rendering the token to the page can't happen without inserting that same token into the cookie.
-
- May 2024
-
github.com github.com
-
github.com github.com
-
You'll need to either stop transpiling or use a Node-based transpiler, like those in jsbundling-rails and cssbundling-rails.
-
-
-
The asset pipeline is a collection of components that work together. Here's a list of what they might be.Concatenation for merging together many files into one big file.Minification for compressing the contents of a file to make it smaller in size.Pre-compilation for using your language of choice to write CSS or Javascript.Fingerprinting to force reloading of asset changes (i.e., cache busing).
-
-
stackoverflow.com stackoverflow.com
-
I can confirm that this is still actual for Rails 7 - jpEg converts to jpg and your production fails.
-
-
nickjanetakis.com nickjanetakis.com
-
Personally I’m not a fan of running migrations in an ENTRYPOINT script.I think it’s best suited to run this separately as part of your deploy process
-
-
mattbrictson.com mattbrictson.com
-
Performing a redirect by constructing a URL based on user input is inherently risky, and is a well-documented security vulnerability. This is essentially what you are doing when you call redirect_to params.merge(...), because params can contain arbitrary data the user has appended to the URL.
Tags
Annotators
URL
-
- Mar 2024
-
blog.litsea.net blog.litsea.net
-
foreign_key: { to_table: :assoc_name }
Tags
Annotators
URL
-
- Feb 2024
-
github.com github.com
Tags
Annotators
URL
-
- Jan 2024
-
mattbrictson.com mattbrictson.com
-
Some frameworks call this “template inheritance”. In this example, we might say that the application layout “inherits from” or “extends” the base layout. In Rails, this is known as nested layouts, and it is a bit awkward to use. The standard Rails practice for nested layouts is complicated and involves these considerations
-
But what if you want to reuse one layout within another?
-
- Dec 2023
- Nov 2023
-
-
On reload, the namespaces are safe, won't be reloaded. The loader only reloads what it manages, which in this case is the adapter itself.
-
-
guides.rubyonrails.org guides.rubyonrails.org
-
In this example, we still want app/models/shapes/circle.rb to define Circle, not Shapes::Circle. This may be your personal preference to keep things simple, and also avoids refactors in existing code bases. The collapsing feature of Zeitwerk allows us to do that:
-
-
edgeguides.rubyonrails.org edgeguides.rubyonrails.org
-
pp Rails.autoloaders.main.dirs
-
-
-
People want to autoload from lib, which is understandable. If we can, this use case should have first-class support from the framework.
-
-
-
-
authenticate_by addresses the vulnerability by taking the same amount of time regardless of whether a user with a matching email is found: User.authenticate_by(email: "...", password: "...")
-
-
stackoverflow.com stackoverflow.com
-
helper.singleton_class.include Rails.application.routes.url_helpers
-
ArgumentError: arguments passed to url_for can't be handled. Please require routes or provide your own implementation
-
- Oct 2023
-
rubynor-web-next-lime.vercel.app rubynor-web-next-lime.vercel.app
-
t.daterange :period
-
- Sep 2023
-
-
What can we do to undo this commit?
-
- Aug 2023
-
stackoverflow.com stackoverflow.com
-
I assume that the ActiveStorage::Attachment class gets reloaded dynamically and that the extensions are lost as they are only added during initialization. You’re correct. Use Rails.configuration.to_prepare to mix your module in after application boot and every time code is reloaded: Rails.configuration.to_prepare do ActiveStorage::Attachment.send :include, ::ActiveStorageAttachmentExtension end
-
- May 2023
- Mar 2023
-
github.com github.com
-
before_action -> { doorkeeper_authorize! :public }, only: :index
-
-
stackoverflow.com stackoverflow.com
-
What you're actually trying to do is to have the exact same behaviour that native Devise implementation but on an Engine via API
-
-
-
stackoverflow.com stackoverflow.com
-
kevinjmurphy.com kevinjmurphy.com
-
Our test raises an ActiveRecord::RecordNotFound exception. We know that Rails has special handling to return a 404 status code in this case. However, the request spec still raises the exception.
-
-
- Feb 2023
-
stackoverflow.com stackoverflow.com
-
The reason is Rails only reads and creates the session object when it receives the request and writes it back to session store when request is complete and is about to be returned to user.
-
Session race conditions are very common in Rails. Redis session store doesn't help either! The reason is Rails only reads and creates the session object when it receives the request and writes it back to session store when request is complete and is about to be returned to user.
-
-
-
As you can see from the example, the session cookie is updated on every request, regardless of if the session was modified or not. Depending on when the response gets back to the client last, thats the cookie that will be used in the next call. For example, if in our previous example, if get_current_result’s response was slower than get_quiz, then our cookie would have the correct data and the next call to update_response would of work fine! So sometimes it will work and sometimes not all depending on the internet gods. This type of race condition is no fun to deal with. The implications of this is that using cookie storage for sessions when you are doing multiple ajax call is just not safe.
-
A better solution would be to use a server side session store like active record or memcache. Doing so prevents the session data from being reliant on client side cookies. Session data no longer has to be passed between the client and the server which means no more potential race conditions when two ajax are simultaneously made!
-
- Jan 2023
-
stackoverflow.com stackoverflow.com
- Dec 2022
-
github.com github.com
-
When configuring SMTP settings in an after_initialize block, the settings aren't picked up by ActionMailer. This leads to runtime errors, since ActionMailer tries the default settings.
-
- Nov 2022
-
github.com github.com
- Sep 2022
- Jul 2022
-
www.reddit.com www.reddit.com
-
It really only takes one head scratching issue to suck up all the time it saves you over a year, and in my experience these head scratchers happen much more often than once a year. So in that sense it's not worth it, and the first time I run into an issue with it, I disable it completely.
-
-
github.com github.com
-
discuss.rubyonrails.org discuss.rubyonrails.org
-
Overriding the ActiveStorage controllers to add authentication or customize behavior is a bit tedious because it requires either: using custom routes, which means losing the nice url helpers provided by active storage copy pasting the routes in the application routes.rb, which is not very DRY.
-
-
github.com github.com
-
it should be normal for production apps to add authentication and authorization to their ActiveStorage controllers. Unfortunately, there are 2 possible ways to achieve it currently: Not drawing ActiveStorage routes and do everything by yourself Override/monkey patch ActiveStorage controllers None of them is ideal because in the end you can't benefit from Rails upgrades (bug fixes, etc) so the intention of this PR is to let people define a parent controller (inspired by Devise, maybe @carlosantoniodasilva can tell us his experience on this feature) so that people can add authentication and authorization in a single place and still benefit from the default controllers.
-
- Apr 2022
-
kit.svelte.dev kit.svelte.dev
-
The combined stuff is available to components using the page store as $page.stuff, providing a mechanism for pages to pass data 'upward' to layouts.
bidirectional data flow ?! That's a game changer.
analogue in Rails: content_for
-
-
edgeguides.rubyonrails.org edgeguides.rubyonrails.org
-
rubyonrails.org rubyonrails.orgDoctrine1
-
Tags
Annotators
URL
-
-
rubyonrails.org rubyonrails.org
-
topdigital.agency topdigital.agency
-
Top Web Design & Development Agencies Winter 2022
Interesting list of agencies. Know guys from ukrainian company Sloboda Studio. They provide high-quality service on time and at a reasonable cost.
-
-
github.com github.com
-
after_commit { puts "We're all done!" }
Notice the order: this is printed last, after the outer (real) transaction is committed, not when the inner "transaction" block finishes without error.
-
-
mattbrictson.com mattbrictson.com
-
In Rails, this is known as nested layouts, and it is a bit awkward to use. The standard Rails practice for nested layouts is complicated and involves these considerations:
-
- Mar 2022
-
github.com github.com
-
github.com github.com
-
- Feb 2022
-
blog.saeloun.com blog.saeloun.com
-
github.com github.com
Tags
Annotators
URL
-
-
guides.rubyonrails.org guides.rubyonrails.org
-
As of Rails 7.0+, Active Record has an option for handling associations that would perform a join across multiple databases.
impressive
-
-
guides.rubyonrails.org guides.rubyonrails.org
-
You can also use silence_redefinition_of_method if you need to define the replacement method yourself (because you're using delegate, for example).
-
-
github.com github.com
-
composed_of attr, :class_name => 'AddressableRecord::Address', :converter => :convert, :allow_nil => true,
-
-
-
belongs_to :city
-
-
github.com github.com
-
belongs_to :zipcode
-
-
github.com github.com
-
acts_as_tokened Quickly adds rails 5 has_secure_token to your model, along with some Post.find() enhancements to work with tokens instead of IDs.
-
include Effective::CrudController
-
# All queries and objects will be built with this scope resource_scope -> { current_user.posts } # Similar to above, with block syntax resource_scope do Post.active.where(user: current_user) end
-
-
github.com github.com
-
enumerate_by :alpha_2_code
-
-
www.ruby-toolbox.com www.ruby-toolbox.com
- Jan 2022
-
stackoverflow.com stackoverflow.com
-
guides.rubyonrails.org guides.rubyonrails.org
-
403 :forbidden
-
401 :unauthorized
-
-
coreyward.svbtle.com coreyward.svbtle.com
-
Rails 5 recently shipped, and among many other new features is a new renderer that makes it easy to render fully composed views outside of your controllers.
-
- Dec 2021
-
-
How to Create a Micro-Job Marketplace Like Fiverr: Features, Cost, TimelineTimurTech JournalistMarketplaceProduct GuideHomeBlogEntrepreneurshipHow to Create a Micro-Job Marketplace Like Fiverr: Features, Cost, TimelinePublishedNov 19, 2021UpdatedNov 19, 202120 min readIt’s no secret that the COVID-19 pandemic has led many people to reconsider their jobs. Now, freelance as an alternative career path steadily becomes a reality. 50.9% of the U.S. workforce will be freelancing by 2027, a Statista survey shows. Businesses like Fiverr and fellow gig-focused companies rode the wave. To be more precise, they adopted a model allowing the hire of independent contractors without any legwork. How do such tools set the new trend in powering freelancers? In this article, we share proven methods geared towards freelance website growth. Moreover, you will get a glimpse of how to create a micro-job marketplace like Fiverr of your own.
It’s no secret that the COVID-19 pandemic has led many people to reconsider their jobs. Now, freelance as an alternative career path steadily becomes a reality. 50.9% of the U.S. workforce will be freelancing by 2027, a Statista survey shows.
Businesses like Fiverr and fellow gig-focused companies rode the wave. To be more precise, they adopted a model allowing the hire of independent contractors without any legwork. How do such tools set the new trend in powering freelancers?
In this article, we share proven methods geared towards freelance website growth. Moreover, you will get a glimpse of how to create a micro-job marketplace like Fiverr of your own.
Tags
- online marketplace
- micro-job website
- entrepreneurship
- micro-job marketplace
- website like Fiverr
- How to Create a Micro-Job Marketplace Like Fiverr
- marketplace website
- custom solution
- freelance marketplace
- custom software
- building marketplace
- Ruby on Rails marketplace
- marketplace development
- Codica
- two-sided marketplace
- micro-job site
- cost to build marketplace
- freelance portal
- freelance website
- Codcia blog
- e-markteplace
- Fiverr
- online marketplace development
Annotators
URL
-
- Nov 2021
-
-
How to Choose a Reliable SaaS Application Development CompanyKateCloud & SaaS Product ResearcherDmitryCEOSaaSHomeBlogEntrepreneurshipHow to Choose a Reliable SaaS Application Development CompanyPublishedAug 5, 2020UpdatedAug 5, 202012 min readCurrently, SaaS is the largest segment of the global public cloud services market. The growing SaaS industry provides an equal-opportunity atmosphere for businesses. It concerns enterprises from startups to tech giants – and any size in between. It explains why traditional software companies, like Microsoft and Adobe, decided to look into that direction too. Indeed, the time is ripe for developing a SaaS application now. But however tempting it may be, do not dive in headfirst with launching a SaaS product, because sometimes, it can be very challenging. That is why we have prepared a guide on finding a SaaS application development company that will be your best bet.
Looking to build a SaaS app? You will need help of a reliable development team. Check our advice on how to choose a SaaS development company.
Tags
- Ruby
- software agency
- SaaS solutions
- software company
- SaaS pricing
- RoR developers
- SaaS App
- custom software
- Ruby gems
- software development
- SaaS market
- Ruby on Rails marketplace
- Ruby on Rails development company
- Ruby on Rails
- RoR
- SaaS
- software provider
- SaaS MVP
- Ruby on Rails framework
- SaaS hosting provider
- SaaS development
Annotators
URL
-
-
-
SaaS Product Development: Why Choose Ruby on Rails Framework?KateCloud & SaaS Product ResearcherRuby/RailsSaaSHomeBlogTechnologySaaS Product Development: Why Choose Ruby on Rails Framework?PublishedSep 10, 2020UpdatedSep 10, 202013 min readWhich technology to pick for your SaaS business to succeed? This question is not uncommon in our days. In fact, quite the opposite because the SaaS model has become a meaningful part of every business domain. And the demand for SaaS product development is higher than ever and still increasing. This article will discuss the essential factors you need to consider when selecting a framework for your SaaS project. Also, we will introduce the top 3 frameworks for building a SaaS product with their pros and cons. Read on to see the best examples of SaaS applications.
Choosing the right tech stack can help you save costs and make your app stand out in the saturated market. Let’s discuss why Ruby on Rails can be your best choice.
-
-
-
What Makes Ruby on Rails Perfect for Marketplace Development?AlinaE-Commerce & SaaS StrategistMarketplaceRuby/RailsHomeBlogEntrepreneurshipWhat Makes Ruby on Rails Perfect for Marketplace Development?PublishedJul 13, 2020UpdatedJul 13, 202012 min readThe last several years have been marked with the rise of different marketplaces. Airbnb, AliExpress, Etsy, Booking.com are on everyone’s lips. That's not surprising that the idea of launching a second Amazon or eBay seems so appealing. To win the e-commerce race, entrepreneurs focus on providing excellent customer experience and build fast-loading and scalable websites. Besides, business owners take various security measures to protect their customers’ sensitive information. This way, they can gain clients’ trust and boost sales. When building a custom marketplace, what technology stack is best to achieve all these goals? Our answer is simple: Ruby on Rails. In this article, we will fill you in on the Ruby on Rails marketplace development. At Codica, we are passionate fans of this framework and have built numerous e-commerce platforms with its help. Based on our experience, we will discuss the key reasons to choose RoR for building a successful marketplace.
The last several years have been marked with the rise of different marketplaces. Airbnb, AliExpress, Etsy, Booking.com are on everyone’s lips. That's not surprising that the idea of launching a second Amazon or eBay seems so appealing.
To win the e-commerce race, entrepreneurs focus on providing excellent customer experience and build fast-loading and scalable websites. Besides, business owners take various security measures to protect their customers’ sensitive information. This way, they can gain clients’ trust and boost sales.
When building a custom marketplace, what technology stack is best to achieve all these goals? Our answer is simple: Ruby on Rails.
In this article, we will fill you in on the Ruby on Rails marketplace development. At Codica, we are passionate fans of this framework and have built numerous e-commerce platforms with its help. Based on our experience, we will discuss the key reasons to choose RoR for building a successful marketplace.
Tags
- Ruby
- e-commerce
- online marketplace
- RoR developers
- ecommerce
- building marketplace
- gems
- Ruby gems
- multi-vendor
- Ruby on Rails marketplace
- marketplace development
- startups
- coding
- Ruby on Rails development company
- Ruby on Rails
- framework
- RoR
- e-commerce platform
- ecommerce website
- emarketplace
- programming languages
- Ruby on Rails framework
- online marketplace development
Annotators
URL
-
-
www.amazon.com www.amazon.com
-
1) Order the one for your particular vehicle if you can otherwise the curvature of the side rails may not be correct which will dent the metal once secured.2) Look/feel under the headliner if you can prior to drilling into the roof, you may hit a beam which will be troublesome running a screw through multiple pieces of metal. You can also cut the side rails if necessary.3) Use non-corrosive silicone (does not smell like vinegar which will eventually eat away at the paint and rust) to seal up the holes that you drill into the roof. End caps doesn't appear to make a tight seal.4) Screws are stainless which are typically soft. Be careful not to overnighten! I actually used a rivnut/blind nut tool instead of just screws (About 25 bucks here on Amazon).
-
- Sep 2021
-
- Jul 2021
-
rails.lighthouseapp.com rails.lighthouseapp.com
-
Rails' inability to automatically route my link_to and form_for in STI subclasses to the superclass is a constant source of frustration to me. +1 for fixing this bug.
I've had to work around this by doing record.as(BaseClass)
-
-
stackoverflow.com stackoverflow.com
-
I don't like that I can't really use head? to know it's a HEAD request, but I (think I) understand the reasoning
-
- Jun 2021
-
github.com github.com
-
As you can see Rails already adds error messages from associated models and doing it wrongly: Merging together errors from different models under same has_many association. :"employments.company"=>["can't be blank"] And this is wrong.
-
-
twitter.com twitter.com
-
So ActionCable needs Redis! Is this the first time Rails is aligning with a vendor product? Why not abstract it like AR/AJ?
-
-
disqus.com disqus.com
-
While rails does have nice CSRF protection, in my instance it limited me.
-
-
docs.gitlab.com docs.gitlab.com
-
GitLab is transitioning from controller specs to request specs.
-
- Apr 2021
-
github.com github.com
-
# unauthenticated do # as :user do # root to: 'devise/registrations#new' # end # end
-
# authenticated :user, lambda {|u| u.role == "admin"} do # root to: "admin/dashboard#show", as: :user_root # end
-
-
github.com github.com
-
There is no request.env in functional tests because the functional tests are supposed to remain at the controller level.
-
-
github.com github.com
-
This is a Rails change of behaviour and Rails is not going back.
-
-
github.com github.com
-
class LoggedInConstraint def self.matches?(request) request.env['warden'].authenticate? end end
(have not tried)
-
-
stackoverflow.com stackoverflow.com
-
class AuthConstraint def initialize(&block) @block = block || ->(_) { true } end def matches?(req) user = current_user(req) user.present? && @block.call(user) end def current_user(req) User.find_by_id(session[:user_id]) end end This is a flexible approach to defining route access based on any desired variable (roles, auth, etc...)
Good solution, and might be needed if you want to base routes on roles, etc. — but this one is even easier if all you need is for it to be conditional based on signed in or not (because devise provides authenticated helper):
-
scope module: 'authenticated', constraints: AuthConstraint.new { |user| user.present? } do # Management dashboard root 'dashboards#index' end root 'home#index'
-
-
stackoverflow.com stackoverflow.com
-
authenticated :user do root 'calendars#index', as: :authenticated_root end unauthenticated :user do root 'pages#home', as: :unauthenticated_root end
-
-
guides.rubyonrails.org guides.rubyonrails.org
-
You can also specify constraints as a lambda:
-
- Mar 2021
-
github.com github.com
-
Meh... as I said earlier, I think using Webpack is the recommended way now. Another issue is there is no way to generate source maps in production.
-
But last I have seen comments from DHH, he considered webpack(er) recommended for JS, but Sprockets still the preferred solution for (S)CSS.
-
I agree about lack of maintenance. It's probably because people use more and more Webpack.
Tags
- official preferred convention / way to do something
- webpack
- shift in preference
- abandoning/migrating away from
- sprockets
- is anyone even still using it anymore?
- possible response/reaction to lack of maintainance / maintainer absence/silence
- switching/migrating from Sprockets to Webpack (Rails)
- unfortunate that this is no longer maintained
- falling out of favor
- switching/migrating to something different
Annotators
URL
-
-
github.com github.com
-
we want source maps in production (like DHH)
-
After waiting years for sprockets to support this we were very happy to see that sprockets 4 officially added support (thanks ), but then when trying to upgrade we noticed there's actually no way to use it in production... (without brittle hacks mentioned above).
-
-
-
Rails still encourages you to dump all validation errors at the top of a form, which is lulzy in this age of touchy UX
-
-
trailblazer.to trailblazer.to
-
Run the complete unit with a certain input set, and test the side-effects. This differs to the Rails Way™ testing style, where smaller units of code, such as a specific validation or a callback, are tested in complete isolation. While that might look tempting and clean, it will create a test environment that is not identical to what happens in production.
-
-
github.com github.com
-
Responders don't use valid? to check for errors in models to figure out if the request was successful or not, and relies on your controllers to call save or create to trigger the validations.
-
- Feb 2021
-
github.com github.com
-
Instead of dealing with a mix of before_filters, Rack-middlewares, controller code and callbacks, an endpoint is just another activity and allows to be customized with the well-established Trailblazer mechanics.
-
-
trailblazer.to trailblazer.to
-
The legendary cfp-app will become a Rails-to-TRB refactoring tutorial.
-
To make it short: we returned to the Rails Way™, lowering our heads in shame, and adhere to the Rails file and class naming structure for operations.
-
-
github.com github.com
-
github.com github.com
-
While Trailblazer offers you abstraction layers for all aspects of Ruby On Rails, it does not missionize you. Wherever you want, you may fall back to the "Rails Way" with fat models, monolithic controllers, global helpers, etc. This is not a bad thing, but allows you to step-wise introduce Trailblazer's encapsulation in your app without having to rewrite it.
Tags
- allowing developer/user to pick and choose which pieces to use (allowing use with competing libraries; not being too opinionated; not forcing recommended way on you)
- making changes / switching/migrating gradually/incrementally/step-wise/iteratively
- freedom of user to override specific decision of an authority/vendor (software)
- focus on concepts/design/structure instead of specific/concrete technology/implementation
- Trailblazer
- rails: the Rails way
- newer/better ways of doing things
- leaving the details of implementation/integration up to you
- focus on what it should do, not on how it should do it (implementation details; software design)
- abstractions
Annotators
URL
-
-
macwright.com macwright.com
Tags
Annotators
URL
-
-
github.com github.com
-
By default, hashes remove any keys that aren't given as nested filters. To allow all hash keys, set strip: false. In general we don't recommend doing this, but it's sometimes necessary.
-
ActiveInteraction type checks your inputs. Often you'll want more than that. For instance, you may want an input to be a string with at least one non-whitespace character. Instead of writing your own validation for that, you can use validations from ActiveModel. These validations aren't provided by ActiveInteraction. They're from ActiveModel. You can also use any custom validations you wrote yourself in your interactions.
-
Since we're using an interaction, we don't need strong parameters. The interaction will ignore any inputs that weren't defined by filters. So you can forget about params.require and params.permit because interactions handle that for you.
-
Note that it's perfectly fine to add errors during execution. Not all errors have to come from type checking or validation.
-
-
-
with ActiveForm-Rails, validations is the responsability of the form and not of the models. There is no need to synchronize errors from the form to the models and vice versa.
But if you intend to save to a model after the form validates, then you can't escape the models' validations:
either you check that the models pass their own validations ahead of time (like I want to do, and I think @mattheworiordan was wanting to do), or you have to accept that one of the following outcomes is possible/inevitable if the models' own validations fail:
- if you use
object.save
then it may silently fail to save - if you use
object.save
then it will fail to save and raise an error
Are either of those outcomes acceptable to you? To me, they seem not to be. Hence we must also check for / handle the models' validations. Hence we need a way to aggregate errors from both the form object (context-specific validations) and from the models (unconditional/invariant validations that should always be checked by the model), and present them to the user.
What do you guys find to be the best way to accomplish that?
I am interested to know what best practices you use / still use today after all these years. I keep finding myself running into this same problem/need, which is how I ended up looking for what the current options are for form objects today...
- if you use
-
I agre with your concern. I realy prefer to do this : form.assign_attributes(hash) if form.valid? my_service.update(form) #render something else #render somthing else end It looks more like a normal controller.
-
My only concern with this approach is that if someone calls #valid? on the form object afterwards, it would under the hood currently delete the existing errors on the form object and revalidate. The could have unexpected side effects where the errors added by the models passed in or the service called will be lost.
-
My concern with this approach is still that it's somewhat brittle with the current implementation of valid? because whilst valid? appears to be a predicate and should have no side effects, this is not the case and could remove the errors applied by one of the steps above.
Tags
- surprising behavior
- rails: validation: valid? has side effects
- I have a differing opinion
- missing the point
- overlooking/missing something
- feels natural
- unfortunate
- whose responsibility is it?
- evolved into unfortunate state and too late to fix now
- should have no side effects
- rails: validation
- nice API
Annotators
URL
-
-
github.com github.com
-
By explicitly defining the form layout using ::property there is no more need for protecting from unwanted input. strong_parameter or attr_accessible become obsolete. Reform will simply ignore undefined incoming parameters.
-
-
github.com github.com
-
Some developers found work arounds by using virtual attributes to # skip validators
-
-
-
Any attribute in the list will be allowed, and any defined as attr_{accessor,reader,writer} will not be populated when passed in as params. This means we no longer need to use strong_params in the controllers because the form has a clear definition of what it expects and protects us by design.
strong params not needed since form object handles that responsibility.
That's the same opinion Nick took in Reform...
-
-
github.com github.com
-
@conference_form.submit(conference_params)
Surprised they called it
submit
, since that could imply that you're triggering an action called submit.They use other verbs to describe this:
- sync
- populate
- write
Analogous to Reform's sync / sync_models method.
Actually, the name makes a lot of sense when you see it in context:
@conference_form = ConferenceForm.new(conference) @conference_form.submit(conference_params) if @conference_form.save
-
-
github.com github.com
-
Seems similar to Reform, but simpler, plays nicely with Rails
-
-
coderwall.com coderwall.com
-
If you include ActiveModel::Validations you can write the same validators as you would with ActiveRecord. However, in this case, our form is just a collection of Contact objects, which are ActiveRecord and have their own validations. When I save the ContactListForm, it attempts to save all the contacts. In doing so, each contact has its error_messages available.
-
Of course our object doesn't have any contacts yet, so our controller will need to make sure that the form has at least one fields_for block to render by giving it one on initialization
-
- Jan 2021
-
github.com github.com
-
api.rubyonrails.org api.rubyonrails.org
-
config.action_mailer.register_preview_interceptor :css_inline_styler
That's probably the same hook that https://github.com/fphilipe/premailer-rails ties into, for it says:
Emails are only processed upon delivery, i.e. when calling
#deliver
on the email, or when previewing them in rails.
-
-
github.com github.com
-
Previewing You can create a controller that gets the email and then renders the body from it.
mailer preview
-
- Dec 2020
-
github.com github.com
Tags
Annotators
URL
-
- Nov 2020
-
-
In short, I think the idea of public methods being actions works just fine as an api.
-
-
guides.rubyonrails.org guides.rubyonrails.org
-
You can use the match method with the :via option to match multiple verbs at once:
-
-
github.com github.com
Tags
Annotators
URL
-
-
-
-
I was confused as to why there is a dual system running on, there might be reasons for that but let's fix this situation by only using Webpacker to generate our assets.
-
- Sep 2020
-
github.com github.com
-
-
Kiosk provides APIs for integrating WordPress content into a Rails
Tags
Annotators
URL
-
-
github.com github.com
-
<html lang="<%= I18n.locale %>">
-
def svelte_compontent(name, props) content_tag(:div, nil, id: "svelte-#{name.dasherize}-root", 'data-props': props.to_json) end
-
-
-
github.com github.com
Tags
Annotators
URL
-
- Aug 2020
-
www.onthegosystems.com www.onthegosystems.com
-
Ruby is the programming language used in Translation Proxy. For Sarah, Object Oriented Design “done the Ruby way” is so enjoyable and is the part of her work that she likes most.
-
- Jul 2020
-
guides.rubyonrails.org guides.rubyonrails.org
Tags
Annotators
URL
-
-
-
RAILS_ENV determines which Webpacker YAML settings are used and NODE_ENV determines which webpack configuration is used.
-
This finally brings us to the use case for NODE_ENV=test: JavaScript unit testing By this I mean executing tests, written in JavaScript, against your application JavaScript code within a Node.js process.
-
-
www.reddit.com www.reddit.com
-
You can also just throw<% yield :javascript_packs %>somewhere in your layout, and use<%= content_for :javascript_packs do %><%= javascript_pack_tag 'visitor' %><% end %>
-
-
api.rubyonrails.org api.rubyonrails.org
-
Why did Rails team decide they need to implement their own "version" of Timecop?
On the one hand, that's great to reduce dependencies, but on the other hand, small dependencies are great (and rails already has lots of them), it just bloats ActiveSupport more, and creates a needless "duplication" of an already popular de facto standard for this problem -- one which (unlike Timecop) can't be easily used outside of the Rails/ActiveSupport ecosystem. It doesn't seem different enough to warrant creating it...
Timecop: Works with Rails and non-Rails
ActiveSupport::Testing::TimeHelpers: for use outside rails, requires dependency on bigger gem, AS.
-
-
api.rubyonrails.org api.rubyonrails.org
-
(Note that you rarely want to deal with Time.now, or Date.today, in order to honor the application time zone please always use Time.current and Date.current.)
-
-
github.com github.com
Tags
Annotators
URL
-
-
ruby-prof.github.io ruby-prof.github.io
-
The best way to do this is create a new Rails environment, profile.rb.
-
-
discuss.rubyonrails.org discuss.rubyonrails.org
-
Actually, thats the one thing I’ve always thought Middleman got better than Rails: instead of eg, calling ‘render :admin’ in the general layout, you would ‘wrap_layout :application’ inside the specific (admin) one. It’s much more ergonomic this way.
-
- Jun 2020
-
stackoverflow.com stackoverflow.com
-
gist.github.com gist.github.com
-
edgeguides.rubyonrails.org edgeguides.rubyonrails.org
-
discuss.rubyonrails.org discuss.rubyonrails.org
-
discuss.rubyonrails.org discuss.rubyonrails.org
-
rails.lighthouseapp.com rails.lighthouseapp.com
-
I ran in to what I thought was this issue, but I was using fragment caching. Since the partial was not executed again, the content_for was not called. content_for could be written differently to handle this.
-
-
gist.github.com gist.github.com
-
Supports nested 'cache do' blocks and some fixes
-
-
rails.lighthouseapp.com rails.lighthouseapp.com
-
stackoverflow.com stackoverflow.com
- May 2020
- Apr 2020
-
www.rubydoc.info www.rubydoc.info
-
As mentioned in StateMachines::Machine#state, you can define behaviors, like validations, that only execute for certain states. One important caveat here is that, due to a constraint in ActiveRecord's validation framework, custom validators will not work as expected when defined to run in multiple states.
-
-
guides.rubyonrails.org guides.rubyonrails.org
Tags
Annotators
URL
-
-
github.com github.com
-
For Rails 5, note that protect_from_forgery is no longer prepended to the before_action chain, so if you have set authenticate_user before protect_from_forgery, your request will result in "Can't verify CSRF token authenticity." To resolve this, either change the order in which you call them, or use protect_from_forgery prepend: true.
Tags
Annotators
URL
-
-
stackoverflow.com stackoverflow.com
-
stackoverflow.com stackoverflow.com
-
github.com github.com
-
guides.rubyonrails.org guides.rubyonrails.org
-
Rails also adds a test method that takes a test name and a block. It generates a normal Minitest::Unit test with method names prefixed with test_. So you don't have to worry about naming the methods, and you can write something like:
Or you could use the "it" format mentioned on https://devhints.io/minitest.
Or better yet, just use rspec...
-
-
guides.rubyonrails.org guides.rubyonrails.org
-
The translated model name, translated attribute name, and value are always available for interpolation as model, attribute and value respectively.
Tags
Annotators
URL
-
-
blog.bigbinary.com blog.bigbinary.com
-
github.com github.com
-
Similar to: form_for, but not actually for forms, apparently
Tags
Annotators
URL
-
-
github.com github.com
-
There are few ways to build forms with objects that don't inherit from Active Record, as follows:
Tags
Annotators
URL
-
-
thepugautomatic.com thepugautomatic.com
-
the /rails/info/properties page
Cool. First I'd heard of the /rails/info/properties page!
-